Share your repls and programming experiences

← Back to all posts
Time module in Lua!
JordanDixon1 (297)

I have recently been trying to learn Lua and I have figured out this neat little trick to import the time module from python.

First you put the time.lua file into your repl then you put require "/time"; on your main.lua file and then when you need to use it on main.lua you just need to type in os.sleep(#number of seconds)

The end result:

main.lua:

require "/time";
os.sleep(1);
Commentshotnewtop
UsernameWitheld (0)

I use this:
local function wait(s)
local t=os.clock()+s
repeat until t<=os.clock()
end
Its fairly accurate, didn't know about this way though.