Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- idx = 1
- input={"comfy"}
- output={}
- function join(src,dest)
- if src == dest then
- local temp = {}
- join(src,temp)
- join(temp,dest)
- else
- for k,v in pairs(src) do
- -- print("src entry:",k,v)
- -- if #dest > 0 then print("dest@len:", #dest,dest[#dest]) end
- dest[#dest+1] = v
- -- print("dest@new len:", #dest,dest[#dest])
- -- os.sleep(5)
- end
- end
- end
- print("input:\n",textutils.serialize(input),"\n")
- print("output:\n",textutils.serialize(output),"\n")
- print("joining...")
- join(input, output)
- print("output:\n",textutils.serialize(output),"\n")
- temp={}
- join(output,temp)
- print("temp:\n",textutils.serialize(temp),"\n")
- print("joining temp to output...")
- join(temp,output)
- print("output:\n",textutils.serialize(output),"\n")
- -- with recursion, we ca concatenate a table to itself without infinite looping
- print("joining output to output...")
- join(output,output)
- print("output:\n",textutils.serialize(output),"\n")
- emptyTest={}
- emptyTest2={}
- print("emptyTest:\n",textutils.serialize(emptyTest),"\n")
- print("emptyTest2:\n",textutils.serialize(emptyTest2),"\n")
- join(emptyTest2,emptyTest)
- print("ET after join w/ET2:\n",textutils.serialize(emptyTest),"\n")
- join(emptyTest,emptyTest)
- print("ET after self-join:\n",textutils.serialize(emptyTest),"\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement