Update sPhone.lua
This commit is contained in:
parent
eabf9bf76b
commit
1f4fc5ab4b
1 changed files with 8 additions and 2 deletions
|
@ -46,7 +46,11 @@ local function kernel()
|
||||||
fs.makeDir("/.sPhone/autorun")
|
fs.makeDir("/.sPhone/autorun")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
term.setBackgroundColor(colors.white)
|
||||||
|
term.clear()
|
||||||
|
|
||||||
for k, v in pairs(fs.list("/.sPhone/autorun")) do
|
for k, v in pairs(fs.list("/.sPhone/autorun")) do
|
||||||
|
term.setTextColor(colors.black)
|
||||||
if not fs.isDir("/.sPhone/autorun/"..v) then
|
if not fs.isDir("/.sPhone/autorun/"..v) then
|
||||||
local f = fs.open("/.sPhone/autorun/"..v,"r")
|
local f = fs.open("/.sPhone/autorun/"..v,"r")
|
||||||
local script = f.readAll()
|
local script = f.readAll()
|
||||||
|
@ -55,9 +59,11 @@ local function kernel()
|
||||||
sleep(0)
|
sleep(0)
|
||||||
local ok, err = pcall(function() setfenv(loadstring(script),getfenv())() end)
|
local ok, err = pcall(function() setfenv(loadstring(script),getfenv())() end)
|
||||||
if not ok then
|
if not ok then
|
||||||
printError("Script error: "..v..": "..err)
|
term.setTextColor(colors.red)
|
||||||
|
print("Script error: "..v..": "..err)
|
||||||
fs.move("/.sPhone/autorun/"..v, "/.sPhone/autorun/disabled/"..v)
|
fs.move("/.sPhone/autorun/"..v, "/.sPhone/autorun/disabled/"..v)
|
||||||
printError(v.." disabled to prevent errors")
|
term.setTextColor(colors.blue)
|
||||||
|
print(v.." disabled to prevent errors")
|
||||||
sleep(0.5)
|
sleep(0.5)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue