lua-users home
lua-l archive

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


In looking into my problem, I don't understand why this works:

static void next (void)
{
  lua_Object o = luaL_tablearg(1);
  lua_Object r = luaL_nonnullarg(2);
  Node *n = luaH_next(luaA_Address(o), luaA_Address(r));
  if (n) {
    luaA_pushobject(&n->ref);
    luaA_pushobject(&n->val);
  }
}


Why is arg2 checked to be a nonnullarg? It's a property of next that if
you call it with a second arg == nil, then it starts at the beginning of
the list. This seems to actually WORK like that, but I don't understand,
given the code above, why I don't get an error when I do: "next(foo,nil)"
within lua.


-- 
David Jeske (N9LCA) + http://www.chat.net/~jeske/ + jeske@chat.net