Initial commit

This commit is contained in:
aaron 2023-08-08 21:33:11 +01:00
commit cb002f4f27
50 changed files with 4666 additions and 0 deletions

25
src/watch.luau Normal file
View file

@ -0,0 +1,25 @@
if not game then script = (require :: any) "test/wrap-require" end
local graph = require(script.Parent.graph)
local set_effect = graph.set_effect
local capture = graph.capture
local function watch(effect: () -> ()): () -> ()
local nodes = capture(effect :: () -> nil)
nodes = table.clone(nodes)
for _, node in next, nodes do
set_effect(node, effect, true)
end
local function unwatch()
for _, node in next, nodes do
set_effect(node, effect, nil)
end
end
return unwatch
end
return watch