diff options
author | Kevin <[email protected]> | 2024-11-05 15:53:23 -0300 |
---|---|---|
committer | Kevin <[email protected]> | 2024-11-05 15:53:23 -0300 |
commit | f02e58342c61b4ae312344be2805aa019d65541d (patch) | |
tree | 15d554ae1b232c5495944b989035daa04d3f888f /lang/lua/astal/variable.lua | |
parent | b697dd8e1d936d6a789c73fbacfc65698d2dab39 (diff) |
core: typing for lua
Diffstat (limited to 'lang/lua/astal/variable.lua')
-rw-r--r-- | lang/lua/astal/variable.lua | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lang/lua/astal/variable.lua b/lang/lua/astal/variable.lua index f06fd16..7a0d712 100644 --- a/lang/lua/astal/variable.lua +++ b/lang/lua/astal/variable.lua @@ -17,6 +17,7 @@ local Process = require("astal.process") ---@field private poll_fn? function ---@field private watch_transform? fun(next: any, prev: any): any ---@field private watch_exec? string[] | string +---@overload fun(value?: any): Variable local Variable = {} Variable.__index = Variable @@ -24,19 +25,19 @@ Variable.__index = Variable ---@return Variable function Variable.new(value) local v = Astal.VariableBase() - local variable = setmetatable({ - variable = v, - _value = value, - }, Variable) + local variable = setmetatable({ variable = v, _value = value }, Variable) + v.on_dropped = function() variable:stop_watch() variable:stop_poll() end + v.on_error = function(_, err) if variable.err_handler then variable.err_handler(err) end end + return variable end |