Team Spartan Cookies & Milk Forums
  • Issue Tracker
  • Donations
  • Search
  • Member List
  • Help

Register

Team Spartan Cookies & Milk Forums Garry's Mod Starfall v
« Previous 1 … 14 15 16 17 18 Next »
Chip status function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Linear Mode
Chip status function
14-02-2015, 01:35 PM,
#8
Person8880 Offline
gpj.ecafllorT
*******
Posts: 2,407
Threads: 45
Joined: Sep 2013
RE: Chip status function
(14-02-2015, 01:15 PM)LocInt Wrote:
(14-02-2015, 12:01 PM)Person8880 Wrote: Of course you can't be 100% error free. But having something that allows essentially brushing off errors and ignoring them is still not a good thing.

People would always just restart their stuff and think "meh I'll fix it someday" rather than actually fixing it and having more stable code. Sometimes it can be annoying for something to error and you're not nearby, yes, but for me that's more motivation to fix it so I don't have to worry about it again.

I should note, that for non-quota related errors you can error handle in your code without it crashing. Look at pcall() and xpcall(), also traceback() to help in debugging if you need it.

So if I run all my functions using pcall is it like using try catch? It returns error on fail but does not stop running the ship?
xpcall is the closest to "try-catch". You can't catch quota errors though.

Both pcall and xpcall return true, function return values on success or false, error message on failure. xpcall has the added advantage of running a callback when the error occurs so you can get an accurate stack trace with traceback() at that point.

Either way, they will not stop the chip if they encounter a non-quota error, yes. That doesn't mean that wrapping the whole thing in pcall is what you should do though (unless you have no shame and want unmaintainable code!)
Find
Reply
« Next Oldest | Next Newest »


Messages In This Thread
Chip status function - by LocInt - 13-02-2015, 05:48 PM
RE: Chip status function - by Person8880 - 13-02-2015, 07:02 PM
RE: Chip status function - by LocInt - 14-02-2015, 10:37 AM
RE: Chip status function - by dalolorn - 14-02-2015, 09:43 AM
RE: Chip status function - by Person8880 - 14-02-2015, 10:20 AM
RE: Chip status function - by dalolorn - 15-02-2015, 09:08 AM
RE: Chip status function - by Person8880 - 14-02-2015, 12:01 PM
RE: Chip status function - by LocInt - 14-02-2015, 01:15 PM
RE: Chip status function - by Person8880 - 14-02-2015, 01:35 PM
RE: Chip status function - by LocInt - 14-02-2015, 02:15 PM

  • View a Printable Version
Forum Jump:


Users browsing this thread: 1 Guest(s)
Contact UsTeam Spartan Cookies & MilkReturn to TopLite (Archive) ModeMark all forums readRSS Syndication

Powered By MyBB, © 2002-2026 MyBB Group.