Allocate reg table with all values in one shot
This commit is contained in:
parent
e2cdb97e2f
commit
7c14161608
24
init.lua
24
init.lua
|
@ -142,20 +142,20 @@ end
|
||||||
-- {{{ Global functions
|
-- {{{ Global functions
|
||||||
-- {{{ Register a widget
|
-- {{{ Register a widget
|
||||||
function register(widget, wtype, format, timer, warg)
|
function register(widget, wtype, format, timer, warg)
|
||||||
local reg = {}
|
|
||||||
local widget = widget
|
local widget = widget
|
||||||
|
local reg = {
|
||||||
|
-- Set properties
|
||||||
|
wtype = wtype,
|
||||||
|
format = format,
|
||||||
|
timer = timer,
|
||||||
|
warg = warg,
|
||||||
|
widget = widget,
|
||||||
|
|
||||||
-- Set properties
|
-- Update function
|
||||||
reg.wtype = wtype
|
update = function ()
|
||||||
reg.format = format
|
update(widget, reg)
|
||||||
reg.timer = timer
|
end,
|
||||||
reg.warg = warg
|
}
|
||||||
reg.widget = widget
|
|
||||||
|
|
||||||
-- Update function
|
|
||||||
reg.update = function ()
|
|
||||||
update(widget, reg)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Default to 2s timer
|
-- Default to 2s timer
|
||||||
if reg.timer == nil then
|
if reg.timer == nil then
|
||||||
|
|
Loading…
Reference in New Issue