lua-users home
lua-l archive

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


On Mon, May 31, 2010 at 9:03 AM, duck <duck@roaming.ath.cx> wrote:
> Can this 5.1 code:
>
>    lua_getfield(L, LUA_GLOBALSINDEX, name);
>
> be made ready for 5.2 by writing this instead:
>
>    lua_pushglobaltable(L);
>    lua_getfield(L,-1,name);
>    lua_remove(L,-2);

5.1 and 5.2-work3 both define a macro called lua_getglobal(L, name),
which seems the easiest choice here. That said, it expands to your 5.1
code under 5.1, and to your proposed code under 5.2.