This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Pharap's profile picture

does tostring on tables and functions give a hash or a memory address

Started by Pharap, 04 November 2012 - 03:59 AM
Pharap #1
Posted 04 November 2012 - 04:59 AM
When one uses the tostring function on a table or function, does the hexadecimal code that follows 'table: ' or 'function: ' represent the memory address of the table/function, or is it merely a hash?
kazagistar #2
Posted 04 November 2012 - 07:37 AM
If it is a memory location, it is merely an implementation detail. The number is only a unique ID according to the spec.

Why are you curious about this?
Pharap #3
Posted 04 November 2012 - 02:10 PM
Just wondering out of interest, it would be useful to know for a project I'm working on.
PixelToast #4
Posted 04 November 2012 - 02:18 PM
you mean using cheat engine, right? :D/>/>
Pharap #5
Posted 04 November 2012 - 02:56 PM
I have no clue what that would even be.
kazagistar #6
Posted 05 November 2012 - 07:25 AM
I know it is the memory location in the standard C implementation of Lua, but I dunno about JLua… it runs on the JVM, which could seriously obscure some lower level stuff like that.
Pharap #7
Posted 05 November 2012 - 11:35 AM
I would assume it's the same, but Java likes to be different from the C-likes, so it's always possible it's something else.
Cloudy #8
Posted 06 November 2012 - 12:17 AM
Best way to find out is to look at the LuaJ Docs/Code.