iPanda Posted February 1, 2015 Share Posted February 1, 2015 Hi guys. How can i do reverse all elements in table? Example: --source local test = { {'13'}, {'42'}, {'51'}, } --reverse local test = { {'51'}, {'42'}, {'13'}, } The problem was solved by itself. Can anyone come in handy: function table.reverse(t) local reversedTable = {} local itemCount = #t for k, v in ipairs(t) do reversedTable[itemCount + 1 - k] = v end return reversedTable end Link to comment
Recommended Posts