lua-users home
lua-l archive

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


>>>Is it safe to realloc a lua_State just after a call to lua_open?
>> 
>> Why would you want to do this?

>In order to be able to add application specific data to it?

The simplest way to do this right-out-of-the-box is to use the registry.

You can also recompile Lua with a suitable definition of LUA_USERSTATE.
Lua will then allocate states in a block with two parts:
	
		| LUA_USERSTATE | Lua state |

and so you can backup the lua_State pointer to access your LUA_USERSTATE.
--lhf