lua-users home
lua-l archive

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


Em dom., 8 de nov. de 2020 às 01:02, Ranier Vilela <ranier.vf@gmail.com> escreveu:
Em sáb., 7 de nov. de 2020 às 22:07, Sean Conner <sean@conman.org> escreveu:
  // You can solve this several ways---one is to call lua_pop(L,1) to pop
  // MyItem off the stack, or to use lua_pushvalue(L,-2) to copy MyValue to
  // the top of the stack.  Another way is to generate the uservalues in
  // reverse order, thus avoiding the lua_pop() or lua_pushvalue() calls.
Many thanks, I will try.
In reverse order, I think it is not possible, MyItem is part of MyValue.
But I think of using it (MyItem) independently of MyValue, when this is possible.

lua_pushvalue, works, but only if disable that:
//luaL_getmetatable(L, MYITEM_REGISTRY);
//lua_setmetatable(L, -2);
lua_pushvalue(L, -2);
 
How to discover what MyValue position is?
Why does the register metatable MYITEM_REGISTRY confuse MYVALUE_REGISTRY?

regards,
Ranier Vilela