Add InstanceMap:destroyInstance for forgetting and destroying in one step

This commit is contained in:
Lucien Greathouse
2019-03-19 16:29:56 -07:00
parent 469f9c927f
commit f9e86e58d6

View File

@@ -45,6 +45,16 @@ function InstanceMap:removeInstance(instance)
end
end
function InstanceMap:destroyInstance(instance)
local id = self.fromInstances[instance]
if id ~= nil then
self:destroyId(id)
else
Logging.warn("Attempted to destroy untracked instance %s", tostring(instance))
end
end
function InstanceMap:destroyId(id)
local instance = self.fromIds[id]
self:removeId(id)