[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: realloc lua_State
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Wed, 17 Dec 2003 10:55:52 -0200
>>>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