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",
|
title="Grab",
|
||||||
info="Grab - Official OpenComputerScripts Installer",
|
info="Grab - Official OpenComputerScripts Installer",
|
||||||
files={
|
files={
|
||||||
"grab.lua",
|
"grab.lua"="__bin__/",
|
||||||
["grab_installer.lua"]="/tmp/.grab_installer.lua"
|
["grab_installer.lua"]="__installer__"
|
||||||
},
|
}
|
||||||
installer="/tmp/.grab_installer.lua"
|
|
||||||
},
|
},
|
||||||
["checkarg"]={
|
["checkarg"]={
|
||||||
title="Arugment Checker",
|
title="Arugment Checker",
|
||||||
|
@ -69,11 +68,21 @@
|
||||||
"shrink.lua"
|
"shrink.lua"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
["libkeepup"]={
|
||||||
|
title="Keep Up!",
|
||||||
|
info="Avoid 'too long without yielding' by keepUp",
|
||||||
|
files={
|
||||||
|
["libs/libkeepup.lua"]="__lib__/"
|
||||||
|
}
|
||||||
|
}
|
||||||
["libcompress"]={
|
["libcompress"]={
|
||||||
title="Compression Library",
|
title="Compression Library",
|
||||||
info="Inflate and deflate library for general purpose.",
|
info="Inflate and deflate library for general purpose.",
|
||||||
files={
|
files={
|
||||||
"libs/libcompress.lua"
|
["libs/libcompress.lua"]="__lib__/"
|
||||||
|
},
|
||||||
|
requires={
|
||||||
|
"libkeepup"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
["libhuffman"]={
|
["libhuffman"]={
|
||||||
|
|
Loading…
Reference in New Issue
Block a user