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

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()

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: 755 / 138
Referenced in: [show references]