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.

31 lines
345 B
Lua

local ecs = require "ecs"
local w = ecs.world()
w:register {
name = "id",
type = "int64",
}
w:register {
name = "data",
type = "lua",
}
for i = 1 , 10 do
w:new {
id = i,
data = "Hello " .. i,
}
end
local function fetch(id)
local v = w:sync("data:in", w:fetch("id", id))
return v.data
end
for i = 1, 10 do
print(fetch(i))
end