lua-users home
lua-l archive

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

> The matter is, is there any way to cancel a script execution
> from within a C fucntion ?
> It would be something like:
> LUA_endExecution( state )

if you call lua_error(), script execution will stop:

from the reference manual:
= void lua_error (lua_State *L, const char *message);
- This function never returns. If lua_error is called from a C function
- that has been called from Lua, then the corresponding Lua execution
- terminates, as if an error had occurred inside Lua code. Otherwise,
- the whole host program terminates with a call to exit(EXIT_FAILURE).
- Before terminating execution, the message is passed to the error
- handler function, _ERRORMESSAGE (see Section 4.7). If message is NULL,
- then _ERRORMESSAGE is not called.

if you don't like the error message you will get, look at the source of that
function and make your own, similar function.