mirror of
https://github.com/Keyslam-Group/Concord.git
synced 2025-09-06 14:17:45 -04:00
Added example how to register the loaded systems via loadNamespace
This commit is contained in:
parent
1aaf501401
commit
1978fc4921
1 changed files with 17 additions and 0 deletions
17
README.md
17
README.md
|
@ -143,6 +143,23 @@ local Systems = {}
|
||||||
Concord.utils.loadNamespace("path/to/systems", Systems)
|
Concord.utils.loadNamespace("path/to/systems", Systems)
|
||||||
|
|
||||||
print(Systems.systemName)
|
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
|
#### Method chaining
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue