Ask coding questions

← Back to all posts
The wait function for LUA - "Is it really that good?"

Well while it is a nice alternate solution since this version of LUA we have isn't exactly the latest, but I have noticed something a little weird about it.. When I try putting decimals into the function call, it's not working as I want it to..-

How can I change it up to make it in a way so it doesn't have to use os.time?

Answered by samfierycreeper [earned 5 cycles]
View Answer

What you are referencing probably looks something like this:

And that is completely fine, but there are better ways to wait. A much better way would be creating a nix repl and getting the lua and luasocket packages. With these packages, you can do something like this:

I did create a repl with Lua 5.3 and luasocket a while back and you can fork it if you want:


@samfierycreeper I don't understand how to do that, sorry-


@Opalmime . If you go to the link I posted and fork the repl (copy it) you can just type socket.sleep(1) and enter a delay into the parenthesis. This delay can be less than a second.

For example:


@samfierycreeper again, don't understand, cuz i just want to make it strictly lua, and if i can only do it in nix then it just seems pointless

Sorry for that, you didn't explain that I didn't have to make a nix replit; would have made my life easier haha-

The thing is I never had to make a nix replit, all I needed to do was:

and it worked! I really needed it since it was for a program I was making (for fun -3-)

And since I actually mostly work on roblox, and am used to just using either wait() or task.wait(), I done:

So, either way this was useful, so thank you.

(note, i was on my phone so i couldn't check for myself .3.)


@Opalmime we all get started somewhere. I got started with Lua on Roblox too. The wait() on Roblox is so useful. Pretty much the only reason I know about LuaSocket is because I tried to make a roblox wait().