lua-users home
lua-l archive

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


Hello everyone !

I'm new at Lua. So far I've compiled Lua 4.1a as 
Shared Lib (dll) on W2k and initalized. To interface
Lua with the GUI Lua-IO has to be redirected. The
code below works so far. An Alert Box pops up
with the Test Message but is immediatly followed by 
another one: "unable to recover; exiting" obviously 
comming from luaD_breakrun(). What's wrong here ?

Well, I didn't dig very deep into the docs  up to
now so please excuse if I've missed something
obvious.

regards

Peter

----------------------------------------------

lua_state lua;

int luaErrorHandler(lua_State state){
 char* msg = lua_tostring(state,1);

/* pop up an Alert Box */

  return 0;
}

void luaInitialize(void){

 lua = lua_newthread(NULL,0);    /* test omitted */

 /* open lua libs */

 lua_baselibopen (lua);
 lua_iolibopen(lua);
 lua_strlibopen(lua);
 lua_mathlibopen(lua);
 lua_dblibopen"(lua);

 /* redirect  io handler */

 lua_register(lua,"_ALERT",luaErrorHandler);
 lua_register(lua,"_OUTPUT",luaOutputHandler);
 lua_register(lua,"_INPUT",luaInputHandler);

/* test */

lua_error("TEST ERROR");
}