Difference between revisions of "ERR"
From OpenEUO
m (Created page with "== Description == ERR is a unique library defined value that is employed in place of nil in certain areas. It's best to pull ERR into the global environment if needed to any...") |
(No difference)
|
Revision as of 20:13, 1 November 2010
Description
ERR is a unique library defined value that is employed in place of nil in certain areas. It's best to pull ERR into the global environment if needed to any degree. The type returned by type(ERR) is 'table', so it should be explicitly tested against if it is an expected return value. ERR only comes into play if inlined error redirection has been selected.
local sl = dofile(getinstalldir()..'/lib/simplelib.lua')
ERR = sl.ERR
sl.slredirect('i') -- enable inline error handling
local td = sl.testdummy(1) -- library test object
local a,b = td.go(3) -- raise a runtime error
print(tostring(a == ERR)..' '..b)
--> 'true 1'