lune icon indicating copy to clipboard operation
lune copied to clipboard

using Instance.Parent as table keys doesnt work

Open FlowGnarly opened this issue 1 year ago • 1 comments

Minimal repro

local roblox = require("@lune/roblox")

local obj = roblox.Instance.new("DataModel")
local child = roblox.Instance.new("ObjectValue")
child.Parent = obj

local t = {
	[obj] = 100,
}

print(t[obj]) -- 100 ✅
print(t[child.Parent]) -- nil ❌

I could just use GetFullName() instead of the instance itself, so this isnt really an issue for me, but I thought I'd make an issue for it anyway.

FlowGnarly avatar Aug 21 '24 18:08 FlowGnarly

I've seen a similar issue and spent most of an evening tracking it down. Basically there seems to be situations where there are two Instance objects that reference the same underlying object in the model or place file. They are considered == to each other but rawequals returns false. I was tearing my hair out over it! It'd be really good if there was only ever one Lua object for any one object in the model/place hierarchy.

eAi avatar Sep 01 '24 09:09 eAi