mirror of
https://github.com/Kiritow/OpenComputerScripts.git
synced 2024-03-22 13:10:46 +08:00
Add libkeepup
This commit is contained in:
parent
01ee8127b9
commit
cb3f0c16df
24
libs/libkeepup.lua
Normal file
24
libs/libkeepup.lua
Normal 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
|
|
@ -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"]={
|
||||
|
|
Loading…
Reference in New Issue
Block a user