Hello all, I am fairly new to metatables and I am currently running into an issue I don’t know how to solve.
Here is a small snippet of my code
--local script
local oldGroup = connectMaster:GetGroupByIdentifier(bankTrade)
print(oldGroup, getmetatable(oldGroup)) --Tried seeing if maybe there was no metatable?
if oldGroup then
oldGroup:Destroy()
end
--The module being referenced
function ConnectionsMeta:Destroy()
print("destroyed", self.Indentifier)
ConnectionsMeta.Groups[self.Indentifier] = nil --The issue is here
self:Disconnect()
end
function ConnectionsMeta:GetGroupByIdentifier(identifier)
return ConnectionsMeta.Groups[identifier]
end
Essentially my issue is that for some reason when I call “Destroy” self is nil.
Here is the output
As you can see it prints the metatable but when I call the Destroy function self isn’t defined??