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,6 +391,7 @@ 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 obj then
|
||||||
if isSystem(obj) then
|
if isSystem(obj) then
|
||||||
tiny_addSystem(world, obj)
|
tiny_addSystem(world, obj)
|
||||||
else -- Assume obj is an Entity
|
else -- Assume obj is an Entity
|
||||||
@@ -398,6 +399,7 @@ function tiny.add(world, ...)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
tiny_add = tiny.add
|
tiny_add = tiny.add
|
||||||
|
|
||||||
--- Removes an Entity to the World.
|
--- Removes an Entity to the World.
|
||||||
@@ -427,6 +429,7 @@ 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 obj then
|
||||||
if isSystem(obj) then
|
if isSystem(obj) then
|
||||||
tiny_removeSystem(world, obj)
|
tiny_removeSystem(world, obj)
|
||||||
else -- Assume obj is an Entity
|
else -- Assume obj is an Entity
|
||||||
@@ -434,6 +437,7 @@ function tiny.remove(world, ...)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
tiny_remove = tiny.remove
|
tiny_remove = tiny.remove
|
||||||
|
|
||||||
-- Adds and removes Systems that have been marked from the World.
|
-- Adds and removes Systems that have been marked from the World.
|
||||||
|
|||||||
Reference in New Issue
Block a user