Module:table/reverse
පෙනුම
- මෙම module සතුව උපදෙස් උප පිටුවක් නොපවතියි. Please නිර්මාණය කරන්න.
- ප්රයෝජනවත් සබැඳි: root page • root page’s subpages • සබැඳි • transclusions • testcases • sandbox
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