lua-users home
lua-l archive

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


The PIL XML parser example has this code:

| static int lxp_parse (lua_State *L) {

[...]

|   xpu->L = L;  /* set Lua state */

The C callbacks use this L as the Lua state for C-to-Lua calls.  I can
see that this works if the XML parser object is only accessed through
Lua (before every callback, L is properly initialized).  In a similar
case, I would like to avoid this restriction.  Is it sufficient to
create a new Lua thread and use its state in the callback?  In
general, I would feel more comfortable about such an approach.