When you set a key as an actual object, what do the key's refer to?

Hi, so I am creating a table (dictionary), and I am setting the key to be the char model, and the value to be a random folder, however I was curious about what the value of the key refers to.

local char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()

local t = {}

t[char] = char

print(t)

This is just a simple test code to showcase what I mean.

{
                    [Instance(1FD4D9BC6B8)] = 0onima
                 }

This is the result of the code btw

  • I have an idea of what it is referring to though, I think it might be referring to the object’s place in memory? However I’m not certain, as long as each reference is unique then it’ll workout perfectly.
1 Like

When an instance is used as a key in a table, Roblox translates that to the instance’s ID. (@waves5217 corrected me)

1 Like

I’m pretty sure this is a Roblox’s hexadecimal reference to an instance and not a memory address. In C language, memory address is usually prefixed with 0x, followed by a hexadecimal address (like 0xc80dec79e5a416bb).

Nevertheless, each instance has its own ID (and also its own DebugId).

image

2 Likes

Thanks for correcting me. Yes it’s not the memory address but rather the Instances ID. That’s my bad.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.