pcAll
Posted: Fri Feb 27, 2009 12:25 pm
I know, I know, but wait until I explain the name:
pcall + All -> pcAll, got it?
Well, basically I've explained the entire purpose with that sentence, this is a tiny lib (if you can call it that) that can convert every table into one where every function is pcalled. So if you don't like big screaming (blue) errors, try this.
I'm open for suggestions, so if you want to have anything changed, ask me.
Further information is posted on request (because I don't want to write an entire story, just so everyone skips it).
Let me explain some more:
pcall is a standard lua function meaning: call in 'protected mode'.
Protected mode means that all errors are catched and processed silently instead of just stopping (in LÖVE with a Blue Screen Of Dying LÖVE).
pcAll is there so you can wrap tables (and now functions) so everytime you call them (or rather the new handle returned by pcAll) the function gets pcalled instead.
This means that every wrapped function then returns a boolean (true/false) saying if the function succeeded and the normal output or the error (as returned by lua).
Hope that's enough.
pcall + All -> pcAll, got it?
Well, basically I've explained the entire purpose with that sentence, this is a tiny lib (if you can call it that) that can convert every table into one where every function is pcalled. So if you don't like big screaming (blue) errors, try this.
I'm open for suggestions, so if you want to have anything changed, ask me.
Further information is posted on request (because I don't want to write an entire story, just so everyone skips it).
Let me explain some more:
pcall is a standard lua function meaning: call in 'protected mode'.
Protected mode means that all errors are catched and processed silently instead of just stopping (in LÖVE with a Blue Screen Of Dying LÖVE).
pcAll is there so you can wrap tables (and now functions) so everytime you call them (or rather the new handle returned by pcAll) the function gets pcalled instead.
This means that every wrapped function then returns a boolean (true/false) saying if the function succeeded and the normal output or the error (as returned by lua).
Hope that's enough.