lua-users home
lua-l archive

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

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().


On Oct 2, 2010, at 1:54 PM, Wesley Smith wrote:

> On Sat, Oct 2, 2010 at 6:26 AM, Sylvain Fabre <> 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;