Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

19
LINES

< > BotCompany Repo | #513 // Snippet merger (side by side)

Lua code

1  
get("#515") -- splitLines
2  
3  
text1 = getSnippet("#2000014")
4  
text2 = getSnippet("#2000003")
5  
6  
lines1 = splitLines(text1)
7  
lines2 = splitLines(text2)
8  
n = math.max(#lines1, #lines2)
9  
10  
w = 0
11  
for i=1, #lines1 do
12  
  w = math.max(w, #lines1[i])
13  
end
14  
15  
for i=1, n do
16  
  line1 = lines1[i] or ""
17  
  line2 = lines2[i] or ""
18  
  print(line1..string.rep(" ", w-#line1).." | "..line2)
19  
end

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: #513
Snippet name: Snippet merger (side by side)
Eternal ID of this version: #513/1
Text MD5: b6e8185a8313078ec96c59b3f1ca8635
Author: stefan
Category:
Type: Lua code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-03-11 15:03:02
Source code size: 382 bytes / 19 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 545 / 148
Referenced in: [show references]