You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
localworld=jecs.World.new()
localpair=jecs.pair-- These components and functions are actually already builtin-- but have been illustrated for demonstration purposeslocalChildOf=world:component()
localName=world:component()
localfunctionparent(entity)
returnworld:target(entity, ChildOf)
endlocalfunctiongetName(entity)
returnworld:get(entity, Name)
endlocalalice=world:entity()
world:set(alice, Name, "alice")
localbob=world:entity()
world:add(bob, pair(ChildOf, alice))
world:set(bob, Name, "bob")
localsara=world:entity()
world:add(sara, pair(ChildOf, alice))
world:set(sara, Name, "sara")
print(getName(parent(sara)))
fore, nameinworld:query(Name, pair(ChildOf, alice)) doprint(name, "is the child of alice")
end-- Output-- "alice"-- bob is the child of alice-- sara is the child of alice
Benchmarks
21,000 entities 125 archetypes 4 random components queried.
Can be found under /benches/visual/query.luau
Inserting 8 components to an entity and updating them over 50 times.
Can be found under /benches/visual/insertions.luau