diff --git a/spec/tiny_spec.lua b/spec/tiny_spec.lua index b92d4c0..2f3179b 100644 --- a/spec/tiny_spec.lua +++ b/spec/tiny_spec.lua @@ -310,4 +310,14 @@ describe('tiny-ecs:', function() assert.are.same(_G, GLOBALS) end) + it("Can set system indices", function() + local world = tiny.world() + local systemA = tiny.system() + local systemB = tiny.system() + world:addSystem(systemA) + world:addSystem(systemB) + world:setSystemIndex(systemA, 1) + assert(true) + end) + end) diff --git a/test.lua b/test.lua new file mode 100644 index 0000000..fe10b63 --- /dev/null +++ b/test.lua @@ -0,0 +1,8 @@ +local tiny = require('tiny') + +local world = tiny.world() +local systemA = tiny.system() +local systemB = tiny.system() +world:addSystem(systemA) +world:addSystem(systemB) +world:setSystemIndex(systemA, 1) diff --git a/tiny.lua b/tiny.lua index 98dd5a6..4dca2cd 100644 --- a/tiny.lua +++ b/tiny.lua @@ -821,6 +821,7 @@ end -- the order in which they Systems processed, because lower indexed Systems are -- processed first. Returns the old system.index. function tiny.setSystemIndex(world, system, index) + tiny_manageSystems(world) local oldIndex = system.index local systems = world.systems