helium/control/state.lua
2020-10-03 15:11:04 +03:00

20 lines
542 B
Lua

local path = string.sub(..., 1, string.len(...) - string.len(".control.state"))
local context = require(path.. ".core.stack")
return function (base)
base = base or {}
local fakeBase = {}
local activeContext = context.getContext()
return setmetatable({},{
__index = function(t, index)
return fakeBase[index] or base[index]
end,
__newindex = function(t, index, val)
print(index, val)
if fakeBase[index] ~= val then
fakeBase[index] = val
activeContext:bubbleUpdate()
end
end
})
end