« Return to Thread: Loading Lua module again
Hello!
For some reasons I have to load my Lua swig module again (lua_state will be closed and created again), therefore I’m searching for a way to re-initialize my module.
My first approach was to modify SWIG_init in luaruntime.swg:
SWIGEXPORT int SWIG_init(lua_State* L)
{
int i;
/*-----------------BEGIN RESET--------------------*/
swig_module.next = 0;
swig_module.type_initial = 0;
swig_module.cast_initial = 0;
swig_module.clientdata = 0;
/*there are as many cast info structures as types*/
for (i = 0; swig_types[i]; i++)
{
swig_types[i]->cast = 0;
swig_types[i]->dcast = 0;
int j=0;
/*variable length array, last element is zero*/
for (j = 0; swig_cast_initial[i][j].type; j++)
{
swig_cast_initial[i][j].next = 0;
swig_cast_initial[i][j].prev = 0;
}
}
/*-----------------END RESET--------------------*/
/* start with global table */
...
But this solution cause some problems when executing the Lua scripts, so I think I missed some important points...
Maybe someone has an idea or a suggestion..? Or a completely different way of solving this problem..?
Thanks,
Thomas
« Return to Thread: Loading Lua module again
| Free embeddable forum powered by Nabble | Forum Help |