lua-users home
lua-l archive

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



On 01/05/2014 09:36, Philipp Janda wrote:
Am 01.05.2014 09:21 schröbte David Demelier:
Hi guys,

Hi!


Some functions already return the type retrieved like lua_getuservalue,
lua_getglobal. It would be nice to have the same behavior for
lua_getfield. So one can easily do:

if (lua_getfield(L, -2, "x") == LUA_TNUMBER)
     x = lua_tointeger(L, -1);
lua_pop(L, 1);

That already works in Lua-5.3work2. It is just not documented yet. But the same request could be made (not sure it hasn't) for `lua_getuservalue` which in Lua 5.3 works for multiple types ...
Ah nice, I haven't look the source and I just check in the Lua 5.3 reference manual :-).