lua-users home
lua-l archive

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



What you want is something like the old lua_pushusertag. This should give you sime ideas:

http://lua-users.org/lists/lua-l/2001-09/msg00121.html

- Peter Shook

Enno Rehling wrote:
I want to write a "next" handler in teh "index" metatable that will return a userdata object. However, I've figured out from the manual and experimentation that I can't just do a lua_pushlightuserdata(L, d->next), because light userdata doesn't have a metatable, and if I write print(a.next.x), lua complains that I'm using an index function of a.next, which is light userdata. How do I make my "next" handler return non-light userdata? I don't want to create a new userdata object, because what I want to return is the actual object that's behind the ->next in C.