Jump to content




Is there any way to error the current lua thread within a peripheral?


  • You cannot reply to this topic
5 replies to this topic

#1 ds84182

  • Members
  • 184 posts

Posted 26 November 2012 - 04:52 AM

Whenever I use CCLights, I may put a value in wrong. The problem is that I need a way to error the current lua thread. It would be great to use IComputerAccess to error the lua thread, but browsing the code yields no results. It would be a great feature for later use by all peripherals.

#2 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 26 November 2012 - 06:14 AM

throw new Exception("Oh noes, we has error!");

#3 ds84182

  • Members
  • 184 posts

Posted 01 December 2012 - 02:33 PM

View PostCloudy, on 26 November 2012 - 06:14 AM, said:

throw new Exception("Oh noes, we has error!");
Thanks Cloudy!

#4 bbqroast

  • Members
  • 124 posts

Posted 02 December 2012 - 04:00 PM

View PostCloudy, on 26 November 2012 - 06:14 AM, said:

throw new Exception("Oh noes, we has error!");
Wouldn't that error the entire game and crash it? Which would be very bad for a server (having the entire server crash because one user inputed a wrong value into a computer).
You could queue an error event (hopefully the user would see it).

#5 Xfel

    Peripheral Designer

  • Members
  • 515 posts

Posted 02 December 2012 - 09:10 PM

Not if you are within IPeripheral.call(). The lua machine catches the exception and propangates it as lua error.

I you are outside it, (eg in the minecraft update loop), this doesn't work of course, but who would try to launch a lua error from there anyway?

#6 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 04 December 2012 - 06:54 AM

View Postbbqroast, on 02 December 2012 - 04:00 PM, said:

View PostCloudy, on 26 November 2012 - 06:14 AM, said:

throw new Exception("Oh noes, we has error!");
Wouldn't that error the entire game and crash it? Which would be very bad for a server (having the entire server crash because one user inputed a wrong value into a computer).
You could queue an error event (hopefully the user would see it).

I wouldn't have suggested it had that been the case.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users