Get the task library for Roblox
or Lune
or Luau
. Inspired by seaofvoices/luau-task.
via pesde
pesde add jiwonz/task
-- It works almost identically in cross-environment.
local task = require("./path/to/task")
local function main() -- We need a separate thread from a main thread in luau.
local s = task.wait(1) -- Since we cannot yield a main thread in luau.
print(`{s} seconds has passed`)
end
if task.start then -- 'task.start' is only available in luau. Starts a new thread(optional) and scheduler.
task.start(main)
else
main()
end
- Make docs based on moonwave docs comments (It'll be published to actual
0.2.0
)
- jackdotink/task.luau - Pure luau task implementation