From 5f41c7a23857cc52ea09b657cf190ff7ef02fdcc Mon Sep 17 00:00:00 2001 From: "Adrian C. (anrxc)" Date: Sun, 7 Mar 2010 04:10:57 +0100 Subject: [PATCH] init: do not use keyword type for user data --- README | 6 +++--- init.lua | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README b/README index 3e0dd98..5f9ed2d 100644 --- a/README +++ b/README @@ -31,13 +31,13 @@ Then add the following to the top of your rc.lua: Once you create a widget (a textbox, graph or a progressbar) call vicious.register() to register it with vicious: - vicious.register(widget, type, format, interval, warg) + vicious.register(widget, wtype, format, interval, warg) widget - widget created with widget() or awful.widget() (in case of a graph or a progressbar) - type + wtype - one of the available widget types, see below for a list format @@ -78,7 +78,7 @@ Restart suspended widgets: - if widget is provided only that widget will be activated Enable caching of a widget type: - vicious.cache(type) + vicious.cache(wtype) - enable caching of values returned by a widget type diff --git a/init.lua b/init.lua index b4f38f3..ec291c8 100644 --- a/init.lua +++ b/init.lua @@ -93,16 +93,16 @@ local function update(widget, reg, disablecache) local data = {} -- Check for chached output newer than the last update - if widget_cache[reg.type] ~= nil then - local c = widget_cache[reg.type] + if widget_cache[reg.wtype] ~= nil then + local c = widget_cache[reg.wtype] if (c.time == nil or c.time <= t-reg.timer) or disablecache then - c.time, c.data = t, reg.type(reg.format, reg.warg) + c.time, c.data = t, reg.wtype(reg.format, reg.warg) end data = c.data else - data = reg.type(reg.format, reg.warg) + data = reg.wtype(reg.format, reg.warg) end if type(data) == "table" then @@ -179,7 +179,7 @@ function register(widget, wtype, format, timer, warg) local widget = widget -- Set properties - reg.type = wtype + reg.wtype = wtype reg.format = format reg.timer = timer reg.warg = warg @@ -240,9 +240,9 @@ end -- }}} -- {{{ Enable caching of a widget type -function cache(type) - if widget_cache[type] == nil then - widget_cache[type] = {} +function cache(wtype) + if widget_cache[wtype] == nil then + widget_cache[wtype] = {} end end -- }}}