hammer/lib/world.luau
Mark Marks cab13e4213 chore: Make jecs a dependency, bump jecs to v0.3.0
+ Make jecs a wally dependency instead of a file in lib. This wasn't done earlier due to wally packages not being able to be used outside of Roblox without dynamically requiring them. Now, a script is used to download the latest source of jecsfrom Github associated with the version in the manifest.

+ Bump jecs-utils to v0.1.3 and release
2024-09-24 15:35:21 +02:00

29 lines
444 B
Text

--!strict
--!optimize 2
local jecs = require("@jecs")
local WORLD: jecs.World
local listeners: { (jecs.World) -> () } = {}
local function get(): jecs.World
return WORLD
end
local function set(world: jecs.World)
WORLD = world
for _, fn in listeners do
fn(world)
end
end
local function on_set(fn: (jecs.World) -> ())
table.insert(listeners, fn)
end
return {
get = get,
set = set,
on_set = on_set,
}