diff options
-rw-r--r-- | main.lua | 35 |
1 files changed, 25 insertions, 10 deletions
@@ -107,6 +107,15 @@ local function update_osd() icons = icons .. '{\\c&HFF6633&&}\226\143\186 ' end + if opt.path and #opt.path > 0 then + local path = '{\\c&H666666&&}' + for i = #opt.path, 1, -1 do + local node = opt.path[i] + path = path .. ' « [' .. node .. ']' + end + str = str .. path + end + out[#out+1] = icons .. str end @@ -256,18 +265,32 @@ local function search_update_osd() update_osd() end -local function search_menu_options_build(options, t) +local function copy_table(t) + local u = {} + for k, v in pairs(t) do + u[k] = v + end + return u +end + +local function search_menu_options_build(options, t, path) local menu = menus[depth] + local path = path or {} for _, v in ipairs(options) do if not t[v.type] then t[v.type] = {} end + + local v = copy_table(v) + v.path = path t[v.type][#t[v.type]+1] = v if v.type == 'category' then + local path = copy_table(path) + path[#path+1] = v.name search_menu_options_build( - category_menu_options(v.category_id), t) + category_menu_options(v.category_id), t, path) end end end @@ -285,14 +308,6 @@ local function search_menu_options(options) return ret end -local function copy_table(t) - local u = {} - for k, v in pairs(t) do - u[k] = v - end - return u -end - local function search_update() local menu = menus[depth] |