mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
Initial commit
This commit is contained in:
commit
cb002f4f27
50 changed files with 4666 additions and 0 deletions
16
src/derive.luau
Normal file
16
src/derive.luau
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
if not game then script = (require :: any) "test/wrap-require" end
|
||||
|
||||
local graph = require(script.Parent.graph)
|
||||
local create = graph.create
|
||||
local get = graph.get
|
||||
local capture_and_link = graph.capture_and_link
|
||||
|
||||
local function derive<T>(fn: () -> T): () -> T
|
||||
local node, node_get = create((nil :: any) :: T)
|
||||
|
||||
node.cache = capture_and_link(node, fn)
|
||||
|
||||
return node_get
|
||||
end
|
||||
|
||||
return derive
|
||||
Loading…
Add table
Add a link
Reference in a new issue