lua-users home
lua-l archive

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


I wonder and ask myself whether the address of a C object isn't, in the
end, exactly that: an integer key?!
Yes, a pointer is a integer value, in C. In Lua, numbers and 
lightuserdata are different things. A number is (usually) a double 
floating point value, while a lightuserdata is an opaque pointer. The 
struct describing both have different tags (LUA_TNUMBER / 
LUA_TLIGHTUSERDATA).
In the same sense, an string containing four bytes could be an (32bit) 
integer as well.
In other words: there will be no collision between a numeric key and a 
lightuserdata key.

--rb