diff --git a/README.md b/README.md index 5ec732b..ad426e1 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ The most simple kind of menus, contexts one, can be created like this: -- To add the menu to a widget: local mytextbox = wibox.widget.textbox() - mytextbox:set_menu(m,3) -- 3 = right mouse button, 1 = left mouse button + mytextbox:set_menu(menu,3) -- 3 = right mouse button, 1 = left mouse button ``` In this example, a simple 3 item menu is created with a dynamically generated diff --git a/init.lua b/init.lua index 25d62bf..918dbbf 100644 --- a/init.lua +++ b/init.lua @@ -11,7 +11,8 @@ end local function set_menu(self,menu,button) if not menu then return end - local b,current,bt = button or 1,self:buttons(),aw_button({},b,function(geo) + local b = button or 1 + local current,bt = self:buttons(),aw_button({},b,function(geo) local m = menu if type(menu) == "function" then if self._tmp_menu and self._tmp_menu.visible then