Share your repls and programming experiences

← Back to all posts
Time module in Lua!
JordanDixon1

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:

Voters
DesireeMurphy
Foster_Bryant
bobbeeperuu
EthanCulp
9SanMarcoKids
jacobbac
Kai_Justice
JordanDixon1
Comments
hotnewtop
Embedded77

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.