« Return to Thread: Loading Lua module again

Loading Lua module again

by Thomas Pollak :: Rate this Message:

| View in Thread

Some parts of this message have been removed. Learn more about Nabble's security policy.

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


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user

 « Return to Thread: Loading Lua module again