Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

20
LINES

< > BotCompany Repo | #537 // printShortenedReferenceTree

Lua code

get("#349") -- table functions

-- without bridge stuff & invalidated
function printShortenedReferenceTree(id, indent, seen, result)
  if seen[id] then
    table.insert(result, indent..id.." (see above)")
  else
    title = getSnippetTitle(id)
    if not (title:find("^Need bridge ") or title:find("^A bridge ") or title:find("^A master bridge ") or hasNTTitle("Invalidate "..id)) then
      table.insert(result, indent..id.. " - "..title)
      seen[id] = true
      
      local refs = getTitleReferences(id)
      --print("Refs: "..tableToString(refs))
      for r in all(refs) do
        printShortenedReferenceTree(r, indent.."  ", seen, result)
      end
    end
  end
end

Author comment

Began life as a copy of #536

test run  test run with input  download  show line numbers   

Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

Comments [hide]

ID Author/Program Comment Date
856 #1000610 Edit suggestion:
!636
!629

main {
static Object androidContext;
static String programID;

public static void main(String[] args) throws Exception {
get("#349") -- table functions

-- without bridge stuff & invalidated
function printShortenedReferenceTree(id, indent, seen, result)
if seen[id] then
table.insert(result, indent..id.." (see above)")
else
title = getSnippetTitle(id)
if not (title:find("^Need bridge ") or title:find("^A bridge ") or title:find("^A master bridge ") or hasNTTitle("Invalidate "..id)) then
table.insert(result, indent..id.. " - "..title)
seen[id] = true

local refs = getTitleReferences(id)
--print("Refs: "..tableToString(refs))
for r in all(refs) do
printShortenedReferenceTree(r, indent.." ", seen, result)
end
end
end
end

}}
2015-08-19 22:48:10  delete 
798 #1000604 (pitcher) 2015-08-20 15:28:24

add comment

Snippet ID: #537
Snippet name: printShortenedReferenceTree
Eternal ID of this version: #537/1
Text MD5: 39af984a29aa73b8c8c1af8a99143fcf
Author: stefan
Category:
Type: Lua code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-03-15 04:25:04
Source code size: 699 bytes / 20 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 1060 / 201
Referenced in: [show references]