Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(t1, t2)
- local result = t1;
- for i = 1, #t2 do
- result[#result + 1] = t2[i];
- end
- return result;
- end
- function printTable(title, tbl)
- print(title)
- for i = 1, #tbl do
- io.write(tbl[i] .. " ");
- end
- print()
- end
- table1 = {4, 7, 2, 3, 1};
- table2 = {8, 5, 7, 4};
- tableResult = solve(table1, table2);
- printTable("First table", table1)
- printTable("Second table", table2)
- printTable("Result", tableResult)
- --[[
- The output
- First table
- 4 7 2 3 1 8 5 7 4
- Second table
- 8 5 7 4
- Result
- 4 7 2 3 1 8 5 7 4
- ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement