Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0

Debugging threads?


3 answers to this question

Recommended Posts

  • 0
  • Solution

the function xpcall should give you a traceback witch will tell you what line the error is genratet


syc, e = xpcall(functionToRun, debug.traceback)
--[[ syc: true or false: where false means that there was an error
e: a full error message i.e:
line bla-bla-bla: bad argument bla-bla-bla
at line bla-bla-bla in function bla-bla-bla



Link to post
Share on other sites
  • 0

also treads doesn't create an critical error in the main scope so a great way to run a thread in terms of debuging is by printing the error on the screen and start a blocking function such as computer.beep()


funciton runThreadWithExelentDebuging(func)
    local syc, e = xpcall(func, debug.traceback)

    if syc == false then
      //syc is false this means an error was genrated in func
      require("computer").beep(500,10) //calling computer.beep to avoid other threads or the main scope to redraw the screen

--disclamer: this is not tested


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.