mlua-luau-scheduler/src/main.luau
2024-01-18 10:52:30 +01:00

17 lines
361 B
Text

for i = 1, 5 do
print("iteration " .. tostring(i) .. " of 5")
local counter = 0
for j = 1, 10_000 do
spawn(function()
wait(0.1 * math.random())
counter += 1
if counter == 10_000 then
print("completed iteration " .. tostring(i) .. " of 5")
end
end)
end
-- FIXME: This resumes instantly with mlua "async" feature
coroutine.yield()
end