From f1844decefb931f5317fa9cadbaf65dfcdd7d829 Mon Sep 17 00:00:00 2001 From: "Joerg T. (Mic92)" Date: Thu, 18 Aug 2011 19:43:09 +0200 Subject: [PATCH] Allocate reg table with all values in one shot --- init.lua | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/init.lua b/init.lua index a65adab..82316ed 100644 --- a/init.lua +++ b/init.lua @@ -141,20 +141,20 @@ end -- {{{ Global functions -- {{{ Register a widget function register(widget, wtype, format, timer, warg) - local reg = {} local widget = widget + local reg = { + -- Set properties + wtype = wtype, + format = format, + timer = timer, + warg = warg, + widget = widget, - -- Set properties - reg.wtype = wtype - reg.format = format - reg.timer = timer - reg.warg = warg - reg.widget = widget - - -- Update function - reg.update = function () - update(widget, reg) - end + -- Update function + update = function () + update(widget, reg) + end, + } -- Default to 2s timer if reg.timer == nil then