Added example how to register the loaded systems via loadNamespace

This commit is contained in:
SelfDevTv 2024-05-27 21:55:13 +02:00
parent 1aaf501401
commit 1978fc4921

View file

@ -143,6 +143,23 @@ local Systems = {}
Concord.utils.loadNamespace("path/to/systems", Systems)
print(Systems.systemName)
-- Registers the loaded systems. Either with a for loop for automatic registering, or manually (you can choose the order)
--for loop
for _, system in pairs(Systems) do
world:addSystem(system)
end
-- or manually
world:addSystems(
Systems.HealthSystem,
Systems.DamageSystem,
Systems.MoveSystem,
-- etc
)
```
#### Method chaining