mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-24 17:10:03 +00:00
Remove key
Remove e
This commit is contained in:
parent
a4fe3b29d1
commit
5476d86e57
2 changed files with 5 additions and 2 deletions
|
@ -31,6 +31,9 @@ do
|
||||||
world:clear(e)
|
world:clear(e)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
local function delete(self)
|
||||||
|
world:delete(e)
|
||||||
|
end
|
||||||
local function id()
|
local function id()
|
||||||
return e
|
return e
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@ local world = require(script.Parent.world)
|
||||||
local handle = require(script.Parent.handle)
|
local handle = require(script.Parent.handle)
|
||||||
local refs = {}
|
local refs = {}
|
||||||
|
|
||||||
local function fini(e, key)
|
local function fini(key)
|
||||||
return function()
|
return function()
|
||||||
refs[key] = nil
|
refs[key] = nil
|
||||||
end
|
end
|
||||||
|
@ -18,7 +18,7 @@ local function ref(key): (handle.Handle, (() -> ())?)
|
||||||
refs[key] = e
|
refs[key] = e
|
||||||
end
|
end
|
||||||
-- Cannot cache handles because they will get invalidated
|
-- Cannot cache handles because they will get invalidated
|
||||||
return handle(e), fini(e, key)
|
return handle(e), fini(key)
|
||||||
end
|
end
|
||||||
|
|
||||||
return ref
|
return ref
|
||||||
|
|
Loading…
Reference in a new issue