Ukendio / jecs

A fast, portable Entity Component System for Luau
https://ukendio.github.io/jecs/
MIT License
121 stars 20 forks source link

World.component() #10

Closed outofbearspace closed 5 months ago

outofbearspace commented 5 months ago

since World.component(world) was being unused, it is now treated the same exact way as World.entity(world)

local world = Jecs.World.new()

local Player = world:component()
local Health = world:component()

local someEntity = world:entity()

world:set(someEntity, Player, 0)
world:set(someEntity, Health, {
    current = 100,
    max = 100,
    regen = 0.01
})

for id, player, health in world:query(Player, Health) do
    print(id, player, health)
end

-- output: 263 0 { current = 100, max = 100, regen = 0.01 }
Ukendio commented 5 months ago

This isn't quite how it should look. I have resolved it in #11 anyways