[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: direct access to allocator's void *ud
- From: Rebel Neurofog <rebelneurofog@...>
- Date: Sat, 18 Jun 2011 21:53:35 +0400
>> There's a way to attach a pointer (possibly pointing to structure of
>> several things you will actually use) to lua_State
>> by passing it to lua_newstate () or by setting it with lua_setallocf ().
> Actually I think the correct method for this is to set LUAI_EXTRASPACE in
Thanks for information: I've missed that
But that's different by 2 aspects:
1. It is build-time feature. Though in my current project that's
irrelevant - I don't use liblua.so
2. The feature is per-coroutine rather than per global_State.
So using LUAI_EXTRASPACE would lead to unnecessary allocations and
access to main thread's state like ((void*) (G(L)->mainthread) -
Looks like Spartaaaaaa!!!!!!!!!!111...
I will use 'lua_getallocf ()' for now or simply write lua_getallocud
() for myself.
But I think lua_getallocud () is good for API in general.