Skip to content
Discussion options

You must be logged in to vote

My setup also uses this form extensively. I'm working around it with this helper function

local function expand(arg)
  result = {}
  queue = { arg }

  item = table.remove(queue)
  while item do
    local children = item["children"]
    if children then
      for i, v in ipairs(children) do
        v["prefix"] = (item["prefix"] or "") .. (v["prefix"] or "")
        table.insert(queue, v)
      end

      local name = item["name"]

      if name then
        table.insert(result, { item["prefix"], group = name })
      end
    else
      item[1] = (item["prefix"] or "") .. item[1]
      item["prefix"] = nil
      table.insert(result, item)
    end

    item = table.remove(queue)
  end

  re…

Replies: 4 comments 7 replies

Comment options

You must be logged in to vote
2 replies
@azzamsa
Comment options

@folke
Comment options

Comment options

You must be logged in to vote
1 reply
@folke
Comment options

Comment options

You must be logged in to vote
4 replies
@folke
Comment options

@PrinceHallGA
Comment options

@erooke
Comment options

@PrinceHallGA
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by ranjithshegde
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants