1 | get("#175") -- tableToString |
2 | get("#349") -- table functions |
3 | |
4 | startID = input or error("Need snippet ID as input") |
5 | |
6 | function makeChain(id, seen, result) |
7 | if not seen[id] then |
8 | seen[id] = true |
9 | |
10 | local refs = getTitleReferences(id) |
11 | --print("Refs: "..tableToString(refs)) |
12 | for r in all(refs) do |
13 | local title = getSnippetTitle(r) |
14 | if not hasNTTitle("Invalidate "..r) and (title:find("^A translation of ") or title:find("^Translation of ")) then |
15 | local _, _, translatorID = title:find(" with #([0-9]+)") |
16 | table.insert(result, translatorID) |
17 | print("r:", r) |
18 | print("translator:", translatorID) |
19 | makeChain(r, seen, result) |
20 | goto out |
21 | end |
22 | end |
23 | ::out:: |
24 | end |
25 | end |
26 | |
27 | result = {} |
28 | makeChain(startID, {}, result) |
29 | result = "!"..table.concat(result, " ") |
30 | print(result) |
31 | return result |
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
No comments. add comment
Snippet ID: | #633 |
Snippet name: | Find single translator chain |
Eternal ID of this version: | #633/1 |
Text MD5: | 693a1e2fcf22cf7d9f13c94dec717083 |
Author: | stefan |
Category: | |
Type: | Lua code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-06-21 21:20:18 |
Source code size: | 875 bytes / 31 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 886 / 176 |
Referenced in: | [show references] |