Update sPhone.lua
This commit is contained in:
parent
63c321360c
commit
cc96e8d185
1 changed files with 5 additions and 8 deletions
|
@ -510,27 +510,24 @@ end
|
||||||
|
|
||||||
sPhone.colourPicker = sPhone.colorPicker -- For UK
|
sPhone.colourPicker = sPhone.colorPicker -- For UK
|
||||||
|
|
||||||
function sPhone.run(_rApp)
|
function sPhone.run(rApp, ...)
|
||||||
if not fs.exists(_rApp) or fs.isDir(_rApp) then
|
if not fs.exists(rApp) or fs.isDir(rApp) then
|
||||||
sPhone.winOk("App not found")
|
sPhone.winOk("App not found")
|
||||||
return
|
return false
|
||||||
end
|
end
|
||||||
local f = fs.open(_rApp, "r")
|
|
||||||
local script = f.readAll()
|
|
||||||
f.close()
|
|
||||||
if sPhone.inHome then
|
if sPhone.inHome then
|
||||||
local sPhoneWasInHome = true
|
local sPhoneWasInHome = true
|
||||||
sPhone.inHome = false
|
sPhone.inHome = false
|
||||||
end
|
end
|
||||||
os.pullEvent = os.oldPullEvent
|
os.pullEvent = os.oldPullEvent
|
||||||
local ok, err = pcall(function() setfenv(loadstring(script),getfenv())() end)
|
local ok, err = pcall(function() setfenv(loadfile(rApp),getfenv())() end)
|
||||||
if not ok then
|
if not ok then
|
||||||
os.pullEvent = os.pullEventRaw
|
os.pullEvent = os.pullEventRaw
|
||||||
term.setBackgroundColor(colors.white)
|
term.setBackgroundColor(colors.white)
|
||||||
term.setTextColor(colors.black)
|
term.setTextColor(colors.black)
|
||||||
term.clear()
|
term.clear()
|
||||||
term.setCursorPos(1,2)
|
term.setCursorPos(1,2)
|
||||||
visum.align("center"," "..fs.getName(_rApp).." crashed",false,2)
|
visum.align("center"," "..fs.getName(rApp).." crashed",false,2)
|
||||||
term.setCursorPos(1,4)
|
term.setCursorPos(1,4)
|
||||||
print(err)
|
print(err)
|
||||||
print("")
|
print("")
|
||||||
|
|
Loading…
Reference in a new issue