Difference between revisions of "Geterror"
From OpenEUO
m (Created page with "== Calling Convention == Call local r[,...] = sl.non([...]) Args a1...aN are of any type Results r1...rN are boolean == Usage Example == local sl = dofile(getinstalldir().....") |
m |
||
Line 1: | Line 1: | ||
== Calling Convention == | == Calling Convention == | ||
Call | Call | ||
− | local | + | local e = sl.geterror(eref) |
Args | Args | ||
− | + | eref is a number | |
Results | Results | ||
− | + | e is a table with key:val pair _type:'table:exception' defined | |
== Usage Example == | == Usage Example == | ||
local sl = dofile(getinstalldir()..'/lib/simplelib.lua') | local sl = dofile(getinstalldir()..'/lib/simplelib.lua') | ||
− | + | local f = function() local a = {} a = a + 1 end | |
− | + | local h = function(eref) | |
− | local | + | local e = geterror(eref) |
− | + | print(e._errmsg) | |
− | + | end | |
− | + | sl.try(f,h) | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
== Description == | == Description == | ||
− | + | geterror returns the recorded error table of a detected table when given a valid numeric error reference, eref. Error table has the following fields: | |
+ | |||
+ | field : description | ||
+ | _type 'table:exception' | ||
+ | _errid Same as the argument provided to geterror. Numeric. | ||
+ | _errname Name provided for the error, or 'SL unknown error'. | ||
+ | _errmsg String of descriptive text associated with the error. | ||
+ | _probe A table of stack information tables for internal use. | ||
== Upon Error == | == Upon Error == | ||
− | If | + | If geterror receives no arguments, or a non-numeric argument, or the argument is out of range, then it returns a single nil value. |
== See Also == | == See Also == |
Revision as of 20:45, 1 November 2010
Calling Convention
Call
local e = sl.geterror(eref)
Args
eref is a number
Results
e is a table with key:val pair _type:'table:exception' defined
Usage Example
local sl = dofile(getinstalldir()..'/lib/simplelib.lua') local f = function() local a = {} a = a + 1 end local h = function(eref) local e = geterror(eref) print(e._errmsg) end sl.try(f,h)
Description
geterror returns the recorded error table of a detected table when given a valid numeric error reference, eref. Error table has the following fields:
field : description _type 'table:exception' _errid Same as the argument provided to geterror. Numeric. _errname Name provided for the error, or 'SL unknown error'. _errmsg String of descriptive text associated with the error. _probe A table of stack information tables for internal use.
Upon Error
If geterror receives no arguments, or a non-numeric argument, or the argument is out of range, then it returns a single nil value.