1 | get("#137") -- split
|
2 | |
3 | text = getSnippet("#2000013")
|
4 | |
5 | lines = split(text, "\n") |
6 | byline = {}
|
7 | n = 0 |
8 | for _, l in ipairs(lines) do |
9 | _, _, x, ann = l:find("^line ([^:]+): +(.*)")
|
10 | if x == nil then |
11 | print("Warning: ignoring line. "..l)
|
12 | else |
13 | a, b = unpack(split(x, "\-")) |
14 | if b == nil then b = a end |
15 | for y = tonumber(a), tonumber(b) do |
16 | byline[y] = ann |
17 | end |
18 | n = math.max(n, tonumber(b)) |
19 | end |
20 | end |
21 | |
22 | for i=1, n do |
23 | print(byline[i] or '') |
24 | end |
e.g. for #2000013
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
2 comment(s) hidden. show
| Snippet ID: | #512 |
| Snippet name: | Line annotations expander |
| Eternal ID of this version: | #512/1 |
| Text MD5: | 19f2e846cf9c59325dbcb6a0633cfed8 |
| Author: | stefan |
| Category: | |
| Type: | Lua code |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2015-03-11 18:10:44 |
| Source code size: | 485 bytes / 24 lines |
| Pitched / IR pitched: | No / Yes |
| Views / Downloads: | 1488 / 246 |
| Referenced in: | [show references] |