Skip to content

Commit

Permalink
Merge pull request #10 from Nimlar/master
Browse files Browse the repository at this point in the history
add new arg for menu.build: sub_menu
  • Loading branch information
lcpz authored Oct 16, 2018
2 parents 2b74554 + 4b0dc21 commit 810f48c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ function menu.build(args)
local icon_size = args.icon_size
local before = args.before or {}
local after = args.after or {}
local sub_menu = args.sub_menu or false
local skip_items = args.skip_items or {}

local result = {}
Expand Down Expand Up @@ -99,6 +100,9 @@ function menu.build(args)
table.sort(result, function(a, b) return string.byte(a[1]) < string.byte(b[1]) end)

-- Add items to menu
if sub_menu then
result = {{sub_menu, result}}
end
for _, v in pairs(result) do _menu:add(v) end
for _, v in pairs(after) do _menu:add(v) end
end)
Expand Down

0 comments on commit 810f48c

Please sign in to comment.