mirror of
https://github.com/bakpakin/tiny-ecs.git
synced 2026-07-21 23:56:50 -06:00
Fix 'tiny.add' and 'tiny.remove' iterating nil values.
This commit is contained in:
@@ -391,10 +391,12 @@ function tiny.add(world, ...)
|
|||||||
local obj
|
local obj
|
||||||
for i = 1, select("#", ...) do
|
for i = 1, select("#", ...) do
|
||||||
obj = select(i, ...)
|
obj = select(i, ...)
|
||||||
if isSystem(obj) then
|
if obj then
|
||||||
tiny_addSystem(world, obj)
|
if isSystem(obj) then
|
||||||
else -- Assume obj is an Entity
|
tiny_addSystem(world, obj)
|
||||||
tiny_addEntity(world, obj)
|
else -- Assume obj is an Entity
|
||||||
|
tiny_addEntity(world, obj)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -427,10 +429,12 @@ function tiny.remove(world, ...)
|
|||||||
local obj
|
local obj
|
||||||
for i = 1, select("#", ...) do
|
for i = 1, select("#", ...) do
|
||||||
obj = select(i, ...)
|
obj = select(i, ...)
|
||||||
if isSystem(obj) then
|
if obj then
|
||||||
tiny_removeSystem(world, obj)
|
if isSystem(obj) then
|
||||||
else -- Assume obj is an Entity
|
tiny_removeSystem(world, obj)
|
||||||
tiny_removeEntity(world, obj)
|
else -- Assume obj is an Entity
|
||||||
|
tiny_removeEntity(world, obj)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user