From d6412b96fd03fdab651a11e6b0fdd73994807488 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Sat, 11 Feb 2017 14:45:42 -0500 Subject: [PATCH] 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 --- docs/03-declarative-layout.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/03-declarative-layout.md b/docs/03-declarative-layout.md index 0c608401d..a25a34e12 100644 --- a/docs/03-declarative-layout.md +++ b/docs/03-declarative-layout.md @@ -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) - local f = unpack or table.unpack -- Lua 5.1 compat - vicious.register(w, f(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(self, f(args)) + end end s.mywibox : setup {