lua-users home
lua-l archive

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

Jim Mathies wrote:
> |
> | You don't have to predict what they do.  Just make sure that a possible
> | error is caught.  How do you start the users code?  With dostring/dofile?
> | Then you are already save!  Executing code with these functions will never
> | reach the exit in ldo.c.
> |
> What about running out of memory on an embedded system? In this case
> exit is called. Or I believe a stack overflow - running out of stack space.
> These are things that can't be 'caught' in Lua but _can_ be dealt with by
> the host program.

No.  All functions that return an error code (lua_dostring/lua_call/...)
will catch these situations.  Out of memory results in ERRMEM, Lua stack
overflow in ERRRUN and a double error in ERRERR.  The lua_State is sane
when these calls return; the running application itself may be damaged

Ciao, ET.