မာတိကာသို့ ခုန်သွားရန်

မော်ဂျူး:table/reverse

ဝစ်ရှင်နရီ မှ

Documentation for this module may be created at မော်ဂျူး:table/reverse/doc

local table_length_module = "Module:table/length"

local function table_len(...)
	table_len = require(table_length_module)
	return table_len(...)
end

--[==[
Takes a list, and returns a new list with the values in the reverse order: { { "a", "b", "c" }} -> { { "c", "b", "a" }}.]==]
return function(t)
	local list, t_len = {}, table_len(t)
	for i = 1, t_len do
		list[i] = t[t_len - i + 1]
	end
	return list
end