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.
39 lines
489 B
Lua
39 lines
489 B
Lua
local ecs = require "ecs"
|
|
|
|
local w = ecs.world()
|
|
|
|
w:register {
|
|
name = "t",
|
|
"a:bool",
|
|
"b:userdata",
|
|
}
|
|
|
|
w:new {
|
|
t = {
|
|
a = false,
|
|
b = ecs.NULL,
|
|
}
|
|
}
|
|
|
|
local function print_v()
|
|
local v = w:singleton("t", "t:in")
|
|
print(".a = ",v.t.a)
|
|
print(".b = ",v.t.b)
|
|
local v = w:singleton "t"
|
|
w:sync("t:in", v)
|
|
print(".a = ", v.t.a)
|
|
print(".a = ", v.t.b)
|
|
end
|
|
|
|
local ctx = w:context { "t" }
|
|
|
|
print("ctx = ", ctx)
|
|
|
|
local test = require "ecs.ctest"
|
|
|
|
print_v()
|
|
|
|
test.testuserdata(ctx)
|
|
|
|
print_v()
|