lua-users home
lua-l archive

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

> 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:

void RunMain()
        // All app code that would've been in main() goes here.

static int StartExecution(lua_State *L)
   return 0;

int main()
    lua_pushcfunction(L, StartExecution);

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...