lua-users home
lua-l archive

Re: setmetatable vs debug.setmetatable?

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


On 3 Aug 2007, at 05:32, Tony Finch wrote:
See paragraph 5 of section 2.8 of the reference manual. Only tables and
userdata have per-value metatables. The other metatables are per-type.
Hmm, I think I just figured out what went wrong yesterday.
I was trying to create a Lua interface for a couple of C++ classes. I was using lightuserdata to represent the C++ pointer. The first one worked fine. Adding the second C++ class broke the first. I guess what I was doing was setting the metatable for any lightuserdata. (Yes, I know there are things like toLua out there. I was working through this by hand to try to really understand things. Which obviously I still don't!)
David Dunham Development Manager
+1 206 926 5722 GameHouse Studios

AltStyle によって変換されたページ (->オリジナル) /