qtlua/qtlua/qtluautils.cpp
/*! Same as lua_getfield but returns \a nil
  if an error occurs while processing the 
  metatable \a __index event. */
Same as lua_getfield but returns \a nil
if an error occurs while processing the
metatable \a __index event.
Same as lua_getfield but returns \ a nil if an error occurs while processing the metatable \ a __index event .
void
luaQ_getfield(struct lua_State *L, int index, const char *name)
{
  lua_pushvalue(L, index);
  lua_pushcfunction(L, luaQ_gettable);
  lua_insert(L, -2);
  lua_pushstring(L, name);
  lua_Hook hf = lua_gethook(L);
  int hm = lua_gethookmask(L);
  int hc = lua_gethookcount(L);
  lua_sethook(L, 0, 0, 0);
  if (lua_pcall(L, 2, 1, 0))
    {
      lua_pop(L, 1);
      lua_pushnil(L);
    }
  lua_sethook(L, hf, hm, hc);
}
void luaQ_getfield ( struct lua_State * L , int index , const char * name ) { lua_pushvalue ( L , index ) ; lua_pushcfunction ( L , luaQ_gettable ) ; lua_insert ( L , -2 ) ; lua_pushstring ( L , name ) ; lua_Hook hf = lua_gethook ( L ) ; int hm = lua_gethookmask ( L ) ; int hc = lua_gethookcount ( L ) ; lua_sethook ( L , 0 , 0 , 0 ) ; if ( lua_pcall ( L , 2 , 1 , 0 ) ) { lua_pop ( L , 1 ) ; lua_pushnil ( L ) ; } lua_sethook ( L , hf , hm , hc ) ; }
Same as lua_getfield but returns \a nil
if an error occurs while processing the
metatable \a __index event.
Same as lua_getfield but returns \ a nil if an error occurs while processing the metatable \ a __index event .