diff --git a/libs/libkeepup.lua b/libs/libkeepup.lua new file mode 100644 index 0000000..6e47a43 --- /dev/null +++ b/libs/libkeepup.lua @@ -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 \ No newline at end of file diff --git a/programs.info b/programs.info index dd130fd..649c8b4 100644 --- a/programs.info +++ b/programs.info @@ -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"]={