[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: customizable Lua "panic" behavior
- From: "Joshua Jensen" <jjensen@...>
- Date: Mon, 19 Nov 2001 21:20:30 -0700
> 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.
This is the only solution I've actually liked thus far. It is easy to
envision something like:
// All app code that would've been in main() goes here.
static int StartExecution(lua_State *L)
In a way, this is like a C++ exception handler (also illustrated above).
The lua_call() acts just like a C++ try-catch block, except for Lua
Because of this thread popping up over and over, a FAQ should be added
to the Lua documentation...