Update sPhone.lua

This commit is contained in:
Ale2610 2015-07-31 20:27:52 +02:00
parent 9715b84f2e
commit 8372f83779

View file

@ -1,5 +1,3 @@
_G.sPhone = {}
local function crash(err)
os.pullEvent = os.pullEventRaw
if not err then
@ -22,8 +20,47 @@ local function crash(err)
end
end
function kernel()
local function kernel()
_G.sPhone = {
version = "1.0",
eApp = false,
}
if not fs.exists("/.sPhone/apis") then
fs.makeDir("/.sPhone/apis")
end
for k, v in ipairs(fs.list("/.sPhone/apis")) do
os.loadAPI("/.sPhone/apis/"..v)
end
function os.version()
return "sPhone "..sPhone.version
end
local function clear()
term.setBackgroundColor(colors.white)
term.clear()
term.setCursorPos(1,1)
term.setTextColor(colors.black)
end
os.forceShutdown = os.shutdown
os.forceReboot = os.reboot
function os.shutdown()
clear()
print("Goodbye")
sleep(1)
os.forceShutdown()
end
function os.reboot()
clear()
print("See you!")
sleep(1)
os.forceReboot()
end
end
local ok, err = pcall(kernel)