helium/control/state.lua
Elmārs Āboliņš 7419274205 canvas progress
2020-10-19 00:39:37 +03:00

19 lines
519 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)
if fakeBase[index] ~= val then
fakeBase[index] = val
activeContext:bubbleUpdate()
end
end
})
end