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

get("#515") -- splitLines

text1 = getSnippet("#2000014")
text2 = getSnippet("#2000003")

lines1 = splitLines(text1)
lines2 = splitLines(text2)
n = math.max(#lines1, #lines2)

w = 0
for i=1, #lines1 do
  w = math.max(w, #lines1[i])
end

for i=1, n do
  line1 = lines1[i] or ""
  line2 = lines2[i] or ""
  print(line1..string.rep(" ", w-#line1).." | "..line2)
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: 617 / 170
Referenced in: [show references]