mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-22 21:41:37 +00:00
Add InstanceMap:destroyInstance for forgetting and destroying in one step
This commit is contained in:
parent
469f9c927f
commit
f9e86e58d6
1 changed files with 10 additions and 0 deletions
|
|
@ -45,6 +45,16 @@ function InstanceMap:removeInstance(instance)
|
||||||
end
|
end
|
||||||
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)
|
function InstanceMap:destroyId(id)
|
||||||
local instance = self.fromIds[id]
|
local instance = self.fromIds[id]
|
||||||
self:removeId(id)
|
self:removeId(id)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue