From 5ac2fa115182a0d33e5dbbfae464e5f2fb6266c9 Mon Sep 17 00:00:00 2001 From: Ale32bit Date: Sat, 10 Oct 2015 18:28:12 +0200 Subject: [PATCH] Update sPhone.lua --- src/sPhone.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/sPhone.lua b/src/sPhone.lua index d544c3e..8e994f5 100644 --- a/src/sPhone.lua +++ b/src/sPhone.lua @@ -433,6 +433,24 @@ end 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()