beautiful: set metatable correctly

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-04-28 22:54:55 +02:00
parent 79a53769de
commit d2be74e1fe
1 changed files with 3 additions and 10 deletions

View File

@ -22,19 +22,12 @@ local capi =
image = image image = image
} }
--- Theme library --- Theme library.
module("beautiful") module("beautiful")
-- Local data -- Local data
local theme = {} local theme = {}
--- Get a value directly.
-- @param key The key.
-- @return The value.
function __index(self, key)
return theme[key]
end
--- Init function, should be runned at the beginning of configuration file. --- Init function, should be runned at the beginning of configuration file.
-- @param path The theme file path. -- @param path The theme file path.
function init(path) function init(path)
@ -71,9 +64,9 @@ end
--- Get the current theme. --- Get the current theme.
-- @return The current theme table. -- @return The current theme table.
function get() function get()
return _M return theme
end end
setmetatable(_M, _M) setmetatable(_M, { __index = function(t, k) return theme[k] end })
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80