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.
36 lines
385 B
Lua
36 lines
385 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"
|
|
|
|
print(".a = ",v.a)
|
|
print(".b = ",v.b)
|
|
end
|
|
|
|
local ctx = w:context { "t" }
|
|
|
|
print("ctx = ", ctx)
|
|
|
|
local test = require "ecs.ctest"
|
|
|
|
print_v()
|
|
|
|
test.testuserdata(ctx)
|
|
|
|
print_v()
|