lua-users home
lua-l archive

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


dormando wrote:
Hey,

I've been fighting with a nasty bug in the C API for a soon-to-be-GPL'ed project o' mine... for several hours, and I'm wholly stuck. The problem is pretty easy to illustrate:

As usual, a few hours later I'll make a dick of myself.

The issue is that I'm using a lightuserdata instead of a full userdata.

Setting up a **pointer and shoveling that inside the full userdata has completely ameliorated the weirdness.

I do have one real question however; I have the 2nd ed PiL book, the 5.1 ref man, and the online manual. All of which devote a single sentence saying that lightuserdata does not have a metatable. However, this appears to not be the case :P It has a single metatable for all types (like numbers, strings, etc). So when I set another metatable for the second lightuserdata object, it overwrote it globally.

Am I reading the docs wrong and this is intended behavior?

Thanks,
-Dormando