lua-users home
lua-l archive

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


So, if I don't use explicitly luaL_ref with the registry, no integer key will be reserved by the reference mechanism?

Thanks for your response

Alexandre

----------------------------------------
> From: kev82@khn.org.uk
> Date: Thu, 17 May 2012 09:53:33 +0100
> To: lua-l@lists.lua.org
> Subject: Re: Integer keys in registry
>
>
> On 17 May 2012, at 09:46, Alexandre Rion wrote:
>
> > But when I'm looking to the luaL_ref/luaL_unref source code, I don't find any access to the registry. Where does it come from?
>
> The registry is just a table with index LUA_REGISTRYINDEX, so to store a reference in the registry table use
>
> luaL_ref(l, LUA_REGISTRYINDEX)
>
> This allows you to also use luaL_ref with any other table as well.
>
> Thanks,
> Kev