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

27
LINES

< > BotCompany Repo | #526 // Print reference tree for #2000027

Lua code

1  
get("#175") -- tableToString
2  
get("#349") -- table functions
3  
4  
--startID = "#1000233"
5  
startID = "#2000027"
6  
7  
function printReferenceTree(id, indent, seen)
8  
  if seen[id] then
9  
    print(indent..id.." (see above)")
10  
  else
11  
    title = getSnippetTitle(id)
12  
    print(indent..id.. " - "..title)
13  
    seen[id] = true
14  
    
15  
    local refs = getTitleReferences(id)
16  
    --print("Refs: "..tableToString(refs))
17  
    for r in all(refs) do
18  
      printReferenceTree(r, indent.."  ", seen)
19  
    end
20  
  end
21  
end
22  
23  
print("\nReference tree for "..startID..":\n")
24  
25  
printReferenceTree(startID, "", {})
26  
  
27  
print()

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
347 #1000604 (pitcher) 2015-08-18 00:07:22
346 #1000610 Edit suggestion:
!636
!629

main {
static Object androidContext;
static String programID;

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

--startID = "#1000233"
startID = "#2000027"

function printReferenceTree(id, indent, seen)
if seen[id] then
print(indent..id.." (see above)")
else
title = getSnippetTitle(id)
print(indent..id.. " - "..title)
seen[id] = true

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

print("\nReference tree for "..startID..":\n")

printReferenceTree(startID, "", {})

print()
}}
2015-08-18 03:21:30  delete 

add comment

Snippet ID: #526
Snippet name: Print reference tree for #2000027
Eternal ID of this version: #526/1
Text MD5: 60145cdcf5a81f38b668c60e2f2f057a
Author: stefan
Category:
Type: Lua code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-03-13 17:42:14
Source code size: 606 bytes / 27 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 956 / 159
Referenced in: [show references]