reference Problem ?

Hey Guys little Question.

I want to remove a key from a table the key is the object itself.

this works:

local t = collisionManager.getTargets() t[self] = nil

but this dosent

toolkit.removeKey(collisionManager.getTargets(), self) function toolkit.removekey(table, key) table[key] = nil end

can anyone help ? 

Are you getting an error about calling a nil function? You have removekey and removeKey in your snippet, but I don’t know if that’s a typo. The code itself looks sound.

its a typo i dont get an Error the object just stay in the table :confused:

Okay. My other guess is that you’ve called it with colon syntax, i.e.  as

toolkit:removeKey(collisionManager.getTargets(), self)

so table is getting toolkit , and key is getting t. Since it’s still all valid in that case, it fails silently.

Are you getting an error about calling a nil function? You have removekey and removeKey in your snippet, but I don’t know if that’s a typo. The code itself looks sound.

its a typo i dont get an Error the object just stay in the table :confused:

Okay. My other guess is that you’ve called it with colon syntax, i.e.  as

toolkit:removeKey(collisionManager.getTargets(), self)

so table is getting toolkit , and key is getting t. Since it’s still all valid in that case, it fails silently.