doc: Fix an error in the declarative guide

`vicious.register(w, f(args))`
    -> `vicious.register(self, f(args))`

Also add the monkeypatch to other widgets, it makes it more useful
This commit is contained in:
Emmanuel Lepage Vallee 2017-02-11 14:45:42 -05:00
parent 20c132fa38
commit d6412b96fd
1 changed files with 8 additions and 4 deletions

View File

@ -227,11 +227,15 @@ caught by a Lua `metatable` (operator overload).
Code:
-- "Monkeypatch" a new function to wibox.widget.textbox to add vicious
-- "Monkeypatch" a new function to 3 widget classes to add vicious
-- extension support
function wibox.widget.textbox:vicious(args)
for _, wdg in ipairs {
wibox.widget.textbox , wibox.widget.progressbar, wibox.widget.graph
} do
function wdg:vicious(args)
local f = unpack or table.unpack -- Lua 5.1 compat
vicious.register(w, f(args))
vicious.register(self, f(args))
end
end
s.mywibox : setup {