You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
356 B
Lua

local ecs = require "ecs"
local w = ecs.world()
w:register {
name = "a",
type = "int",
}
w:register {
name = "temp",
type = "int",
}
for i = 1, 10 do
w:new { a = i }
end
for v in w:select "a:in" do
if v.a %2 == 0 then
v.a = -v.a
v.temp = 42
w:sync("a:out temp:temp", v)
end
end
for v in w:select "a:in temp?in" do
print(v.a, v.temp)
end