fork download
  1. -- your code goes here
  2.  
  3. a = {{1,2,3,4,},
  4. {5,6,7,8,},
  5. {9,10,11,12},
  6. {13,14,15,16}}
  7.  
  8. bottom = {}
  9. top = {}
  10.  
  11. for i, v in ipairs(a) do
  12. for j, w in ipairs(v) do
  13. if(i > j) then
  14. table.insert(bottom, w)
  15. else if(i < j) then
  16. table.insert(top, w)
  17. end
  18. end
  19. end
  20. end
  21.  
  22. print("Top:")
  23. for i=1, #top do
  24. print(top[i])
  25. end
  26.  
  27. print("Bottom:")
  28. for i = 1, #bottom do
  29. print(bottom[i])
  30. end
Success #stdin #stdout 0.01s 2496KB
stdin
Standard input is empty
stdout
Top:
2
3
4
7
8
12
Bottom:
5
9
10
13
14
15