lua-users home
lua-l archive

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

> On Thursday, June 26, 2014 01:16:57 AM Paige DePol wrote:
> > In vanilla Lua, it does not appear so, you would have to modify the
> > `luaM_realloc_` function to add such functionality yourself. I also run the
> > GC in steps for my game engine so this is something I need to consider as
> > well.
> I was going to say something about a user-defined allocator, but the custom 
> function doesn't have access to the Lua state, does it? That's too bad. I 
> guess you could make the allocator userdata be a lua_State** and copy the 
> state pointer into it after it's created. The pointer would be invalid when 
> creating the state itself, of course.

Note that Lua gives no garanties about what could happen when you call
Lua while inside the allocator function (that is why the state is not
available there).

-- Roberto