lua-users home
lua-l archive

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


> For the sake of simplicity, since my library will be alone (beside the
> standard libraries), I have put the two tags in global variables.

Another option is to put them in the Lua registry. It is simple, and do
not have the problems of global variables (but may be a little slower).


> Once this userdata is pushed on the stack, what does it do there?

It stays there ;-)  (But it is not "this" userdata; see below.)


> Do I have to pop it out?

Yes.


> How this affects actually the real userdata? I am lost.

This trick is not simple, and even not completely correct. (That is why
we changed this whole stuff in 5.0.) When you "push" the userdata, it
coalesces with the userdata that already exists in Lua, so it is the
latter than ends up in the stack.

-- Roberto