lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, 9 Nov 2007, David Manura wrote:

Various function calls used can raise a Lua error (i.e. longjump). For example, lua_getglobal could raise if an __index metamethod on _G raised. lua_pushstring could conceivably raise on memory alloc failure. These possibilities are documented via the [-o, +p, x] designations in the reference manual.

OK, I've now gone through this for all the functions I call, and I'll think what to do about it so as not to make things too restrictive on the one hand or dangerous on the other.

There seems to be an error in the manual: luaL_dostring is listed as being able to throw a general error ("e"), but it can't, it can only throw an out-of-memory error ("m") when calling luaL_loadstring. The same applies to luaL_dofile. Any other errors are indicated by the return value of lua_pcall, not thrown.

--
http://rrt.sc3d.org/ | impatience, n.  the urge to do nothing