[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: luaL_ref usage
- From: Matthew Metnetsky <met@...>
- Date: Thu, 16 Oct 2008 09:54:11 -0400
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Richter wrote:
>> g_value_set_int(&gvalue, luaL_ref(priv->L, -1));
>
> Try
> lua_pushvalue( L, -1 );
> ref = luaL_ref( priv->L, LUA_REGISTRYINDEX );
>
> The t argument of luaL_ref is an index to a table. LUA_REGISTRYINDEX is
> just a special index to the registry table. Make sure to read the
> documentation for luaL_ref
> http://www.lua.org/manual/5.1/manual.html#luaL_ref
>
> And when you try to call your function later:
>
> lua_rawgeti( L, LUA_REGISTRYINDEX, ref );
> lua_call( ... )
>
Jorg,
Thank you very much. After looking at your example and re-reading the
docs it makes a lot of sense.
Thanks!
~ Matthew
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkj3R38ACgkQLrcoBjlTBf3gDACfexRXJB/MXgPKxS/F06R8xXVY
ULkAoJcd9fmjP0r1pQE6qO1ORi7NtCVw
=85w5
-----END PGP SIGNATURE-----