From dcc2b60cd85dabd716e2bb8c49d9703f050eaff5 Mon Sep 17 00:00:00 2001 From: "Joerg T. (Mic92)" Date: Tue, 10 May 2011 00:47:58 +0200 Subject: vicious: load widget modules only when needed There's no more need to edit init files and manually disable widgets. Signed-off-by: Joerg T. (Mic92) Signed-off-by: Adrian C. (anrxc) --- helpers.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'helpers.lua') diff --git a/helpers.lua b/helpers.lua index ef92bfa..223c5f1 100644 --- a/helpers.lua +++ b/helpers.lua @@ -9,6 +9,8 @@ -- {{{ Grab environment local pairs = pairs +local rawget = rawget +local require = require local tonumber = tonumber local io = { open = io.open } local setmetatable = setmetatable @@ -29,6 +31,13 @@ local scroller = {} -- }}} -- {{{ Helper functions +-- {{{ Loader of vicious modules +function wrequire(table, key) + local module = rawget(table, key) + return module or require(table._NAME .. "." .. key) +end +-- }}} + -- {{{ Expose path as a Lua table function pathtotable(dir) return setmetatable({ _path = dir }, -- cgit v1.2.3