Share your repls and programming experiences

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

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:


require "/time";
UsernameWitheld (2)

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