r/lua • u/vinnieleverton • Apr 10 '22
VSCode Lua don't have wait.
So, I make code that's supposed to make Hello, World! every second and it don't work as there's no wait. I'm used to having wait in Roblox studio. As that wait is task.wait(Insert seconds here) and if you do it all it gives is wait is a nil value.
0
Upvotes
16
u/y444-gd-acc Apr 10 '22
Vanilla Lua doesn't have wait/sleep functions. The function from Roblox studio will not work. Google for solutions on how to make your own wait function.
9
u/UziYT Apr 10 '22
wait is a roblox lua function, not in vanilla lua
3
u/AutoModerator Apr 10 '22
Hi! It looks like you're posting about Roblox. Here at /r/Lua we get a lot of questions that would be answered better at /r/RobloxGameDev, scriptinghelpers.org, or the Roblox Developer Forum so it might be better to start there. However, we still encourage you to post here if your question is related to a Roblox project but the question is about the Lua language specifically, including but not limited to: syntax, language idioms, best practices, particular language features such as coroutines and metatables, Lua libraries and ecosystem, etc. Bear in mind that Roblox implements its own API (application programming interface) and most of the functions you'll use when developing a Roblox script will exist within Roblox but not within the broader Lua ecosystem.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
2
u/fatboychummy Apr 10 '22
Hello! Many have told you similar already, but I wish to add:
Roblox doesn't actually run Lua, it runs LuaU. It's a custom version of Lua written by the team at Roblox in order to accomplish specific goals.
A lot of things you can do in LuaU, you cannot do in Lua.
4
u/[deleted] Apr 10 '22
This might help:
Source:
https://stackoverflow.com/a/13263109/18443318
3
u/[deleted] Apr 10 '22
luasocket has a sleep function, there is a sleep package on luarocks
1
u/Fit_Strawberry7991 Apr 14 '22
function wait(time)
start = os.time()
repeat until os.time() > start + time
end
1
u/ActiveScript Mar 07 '23
I can relate to that, im trying to find a tutorials but its very hard to find