get("#137") -- split
text = getSnippet("#2000013")
lines = split(text, "\n")
byline = {}
n = 0
for _, l in ipairs(lines) do
_, _, x, ann = l:find("^line ([^:]+): +(.*)")
if x == nil then
print("Warning: ignoring line. "..l)
else
a, b = unpack(split(x, "\-"))
if b == nil then b = a end
for y = tonumber(a), tonumber(b) do
byline[y] = ann
end
n = math.max(n, tonumber(b))
end
end
for i=1, n do
print(byline[i] or '')
ende.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
| ID | Author/Program | Comment | Date | |
|---|---|---|---|---|
| 943 | #1000604 (pitcher) | 2015-08-20 15:28:24 | ||
| 942 | #1000610 | Edit suggestion: !636 !629 main { static Object androidContext; static String programID; public static void main(String[] args) throws Exception { get("#137") -- split text = getSnippet("#2000013") lines = split(text, "\n") byline = {} n = 0 for _, l in ipairs(lines) do _, _, x, ann = l:find("^line ([^:]+): +(.*)") if x == nil then print("Warning: ignoring line. "..l) else a, b = unpack(split(x, "\-")) if b == nil then b = a end for y = tonumber(a), tonumber(b) do byline[y] = ann end n = math.max(n, tonumber(b)) end end for i=1, n do print(byline[i] or '') end }} | 2015-08-20 06:27:18 | delete |
| 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: | 1416 / 236 |
| Referenced in: | #520 - Backport keywords from new case to known case #2000014 - Expansion of #2000013 #3000190 - Answer for stefanreich(>> t 20 questions) #3000382 - Answer for ferdie (>> t = 1, f = 0) #3000383 - Answer for funkoverflow (>> t=1, f=0 okay) |