1 | get("#175") -- tableToString |
2 | get("#349") -- table functions |
3 | |
4 | startID = input or error("Need snippet ID as input") |
5 | |
6 | function printReferenceTree(id, indent, seen, result) |
7 | if seen[id] then |
8 | table.insert(result, indent..id.." (see above)") |
9 | else |
10 | title = getSnippetTitle(id) |
11 | table.insert(result, indent..id.. " - "..title) |
12 | seen[id] = true |
13 | |
14 | local refs = getTitleReferences(id) |
15 | --print("Refs: "..tableToString(refs)) |
16 | for r in all(refs) do |
17 | printReferenceTree(r, indent.." ", seen, result) |
18 | end |
19 | end |
20 | end |
21 | |
22 | result = {} |
23 | table.insert(result, "Full reference tree for "..startID..":\n") |
24 | printReferenceTree(startID, "", {}, result) |
25 | result = table.concat(result, "\n") |
26 | print("\n"..result) |
27 | return result |
Began life as a copy of #526
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
No comments. add comment
Snippet ID: | #528 |
Snippet name: | Return reference tree (generic) |
Eternal ID of this version: | #528/1 |
Text MD5: | bde4ea56add89877f212e708cfc92a15 |
Author: | stefan |
Category: | |
Type: | Lua code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-03-20 20:09:56 |
Source code size: | 757 bytes / 27 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 896 / 232 |
Referenced in: | [show references] |