Add libkeepup

master
Kirigaya Kazuto 2019-01-07 22:20:32 +08:00
parent 01ee8127b9
commit cb3f0c16df
2 changed files with 38 additions and 5 deletions

24
libs/libkeepup.lua Normal file
View File

@ -0,0 +1,24 @@
-- LibKeepUp
-- Avoid 'too long without yielding'
-- Experimental.
local generator
if(os.sleep) then -- Oh! We are in OpenComputers
local computer=require('computer')
local __last_uptime=computer.uptime()
generator=function(sec)
return function()
local now=computer.uptime()
if(now-__last_uptime>=sec) then
os.sleep(0)
__last_uptime=now
end
end
end
else -- In Standard Lua
generator=function()
return function() end
end
end
return generator

View File

@ -3,10 +3,9 @@
title="Grab",
info="Grab - Official OpenComputerScripts Installer",
files={
"grab.lua",
["grab_installer.lua"]="/tmp/.grab_installer.lua"
},
installer="/tmp/.grab_installer.lua"
"grab.lua"="__bin__/",
["grab_installer.lua"]="__installer__"
}
},
["checkarg"]={
title="Arugment Checker",
@ -69,11 +68,21 @@
"shrink.lua"
}
},
["libkeepup"]={
title="Keep Up!",
info="Avoid 'too long without yielding' by keepUp",
files={
["libs/libkeepup.lua"]="__lib__/"
}
}
["libcompress"]={
title="Compression Library",
info="Inflate and deflate library for general purpose.",
files={
"libs/libcompress.lua"
["libs/libcompress.lua"]="__lib__/"
},
requires={
"libkeepup"
}
},
["libhuffman"]={