[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Extending luaL_Reg with userdata field
- From: Nevin Flanagan <Alestane@...>
- Date: Sat, 2 Oct 2010 14:16:52 -0400
You can also use luaL_openlib instead of luaL_register to associate an upvalue with the functions being registered, and retrieve it inside those functions with lua_upvalueindex().
Nevin
On Oct 2, 2010, at 1:54 PM, Wesley Smith wrote:
> On Sat, Oct 2, 2010 at 6:26 AM, Sylvain Fabre <sylvain.fabre@inpixal.com> wrote:
>> Hi all,
>> We are using extensivly the luaL_Reg structure to handle methods to be
>> applied on C objects.
>> One drawback (as far as i know), is that the structure does not allow the
>> storage of additionnal datas that can be used by callbacks for example
>> So ideally, would it be possible to have something like this :
>>
>> typedef struct luaL_Reg {
>> const char *name;
>> lua_CFunction func;
>> void *udata;
>> } luaL_Reg;
>>