lua-users home
lua-l archive

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


Hello,

(using lua-5.1-work4 on Mac OS X 10.3.7)

Assuming the following Lua chunk:

local aTable = {}
print( tostring( aTable ) )

It would seem that it always prints the same result, even between different VM runs:

"table: 0x102a70"

Is that on purpose? Or is it accidental?

Also, how do I access this magic number? In <gasp>Java</gasp>, there is an handy identityHashCode() method which returns the JVM hashCode for a given object (usually its memory address).

Right now, I'm <gasp>parsing</gasp> the result of tostring():

hashCode = tonumber( string.gsub( tostring( aTable ), type( aTable )..": ", "" ), 16 )

Surely, there must be a more direct way to achieve this :))

TIA.

Cheers

--
PA, Onnay Equitursay
http://alt.textdrive.com/