Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,27 @@
function sleeprint(n)
local t0 = os.time()
while os.time() - t0 <= n do
coroutine.yield(false)
end
print(n)
return true
end
coroutines = {}
for i=1, #arg do
wrapped = coroutine.wrap(sleeprint)
table.insert(coroutines, wrapped)
wrapped(tonumber(arg[i]))
end
done = false
while not done do
done = true
for i=#coroutines,1,-1 do
if coroutines[i]() then
table.remove(coroutines, i)
else
done = false
end
end
end

View file

@ -0,0 +1,29 @@
socket = require 'socket'
function sleeprint(n)
local t0 = socket.gettime()
while (socket.gettime() - t0)*100 <= n do
coroutine.yield(false)
end
print(n)
return true
end
coroutines = {}
for i=1, #arg do
wrapped = coroutine.wrap(sleeprint)
table.insert(coroutines, wrapped)
wrapped(tonumber(arg[i]))
end
done = false
while not done do
done = true
for i=#coroutines,1,-1 do
if coroutines[i]() then
table.remove(coroutines, i)
else
done = false
end
end
end