[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: 0x102a70?
- From: Ben Sunshine-Hill <sneftel@...>
- Date: Sun, 30 Jan 2005 16:38:28 -0800
It's not on purpose, and you shouldn't count on it. You just happen to
have a relatively deterministic memory allocation stack.
If you want to access this magic number from the C side, you can do so
with lua_topointer for several (not all) of the data types. It's
extremely rare to need to do this, though; what are you using the
"magic number" for?
Ben
On Mon, 31 Jan 2005 00:48:41 +0100, PA <petite.abeille@gmail.com> wrote:
> 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/
>
>