Update sPhone.lua

This commit is contained in:
Ale32bit 2015-10-10 18:28:12 +02:00
parent 0388834c0e
commit 5ac2fa1151

View file

@ -434,6 +434,24 @@ end
end
end
function sPhone.run(_rApp)
if not fs.exists(_rApp) or fs.isDir(_rApp) then
sPhone.winOk("App not found")
return
end
local f = fs.open(_rApp, "r")
local script = f.readAll()
f.close()
local ok, err = pcall(function() setfenv(loadstring(script),getfenv())() end)
if not ok then
f.open("/crash/".._rApp,"a")
f.write(err.."\n")
f.close()
sPhone.winOk(_rApp.." crashed","Check /crash")
return false
end
end
local function lChat()
clear()
local w, h = term.getSize()