-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathctrlmenu.lua
More file actions
53 lines (37 loc) · 1012 Bytes
/
ctrlmenu.lua
File metadata and controls
53 lines (37 loc) · 1012 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
--[[
CtrlMenu output module
]]--
function CtrlMenu_ItemsWrite(S, group, depth)
local name, item, str, icon
for name,item in pairs(group.items)
do
if item.name ~= nil and item.type ~= "group"
then
str=item.title
-- if item.icon ~= nil then str=str.. " [#"..item.icon.."] " end
if item.invoke ~= nil then str=str .. " -- " .. item.invoke end
S:writeln(str .."\n")
end
end
end
function CtrlMenu_SubmenuWrite(S, group, depth)
local name, item
if group.name ~= "rootmenu" then S:writeln(group.title.. " {\n") end
-- First go through and write out all the submenus
for name,item in pairs(group.items)
do
if item.type=="group" then CtrlMenu_SubmenuWrite(S, item, depth + 1) end
end
CtrlMenu_ItemsWrite(S, group, depth + 1)
if group.name ~= "rootmenu" then S:writeln("\n}\n") end
end
function CtrlMenu_MenuWrite(menu, Path)
local S
S=OpenOutputFile(Path)
if S ~= nil
then
if #faves_config > 0 then CtrlMenu_ItemsWrite(S, faves_config, -1) end
CtrlMenu_SubmenuWrite(S, menu, -1)
S:close()
end
end