Allocate reg table with all values in one shot
This commit is contained in:
parent
b11d251ef0
commit
f1844decef
18
init.lua
18
init.lua
|
@ -141,20 +141,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
|
-- Set properties
|
||||||
reg.wtype = wtype
|
wtype = wtype,
|
||||||
reg.format = format
|
format = format,
|
||||||
reg.timer = timer
|
timer = timer,
|
||||||
reg.warg = warg
|
warg = warg,
|
||||||
reg.widget = widget
|
widget = widget,
|
||||||
|
|
||||||
-- Update function
|
-- Update function
|
||||||
reg.update = function ()
|
update = function ()
|
||||||
update(widget, reg)
|
update(widget, reg)
|
||||||
end
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
-- Default to 2s timer
|
-- Default to 2s timer
|
||||||
if reg.timer == nil then
|
if reg.timer == nil then
|
||||||
|
|
Loading…
Reference in New Issue