Advertisement
Andy73

Traceback.lua

Jan 2nd, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.93 KB | None | 0 0
  1. local args = {...}
  2. local file = shell.resolve(assert(args[1], "Must enter a path"))
  3.  
  4. local routine = coroutine.create(function()
  5.         xpcall(loadfile(file), function(msg)
  6.                 printError(msg)
  7.                 for i = 3, 15, 1 do
  8.                         local _, err = pcall(error, "", i)
  9.                         if err:match("xpcall:") or err == "" then break end
  10.                         printError("  ", err)
  11.                 end
  12.         end)
  13. end)
  14.  
  15. local filter = nil
  16. while true do
  17.         local ok, param = coroutine.resume(routine, os.pullEventRaw(filter))
  18.         if ok then
  19.                 filter = param
  20.         else
  21.                 printError("Could not catch")
  22.                 printError("  ", param)
  23.                 break
  24.         end
  25.  
  26.         if coroutine.status(cmd.command) == "dead" then
  27.                 print("Exited OK. I think.")
  28.                 break
  29.         end
  30.  
  31.         print("Resume")
  32. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement