added table reverse
This commit is contained in:
parent
deb24f2f3c
commit
13eb4cf3b9
@ -10,3 +10,14 @@ end
|
|||||||
function table.print_table(o)
|
function table.print_table(o)
|
||||||
return print(vim.inspect(o))
|
return print(vim.inspect(o))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function table.reverse(self)
|
||||||
|
local n = #self
|
||||||
|
local i = 1
|
||||||
|
while i < n do
|
||||||
|
self[i], self[n] = self[n], self[i]
|
||||||
|
i = i + 1
|
||||||
|
n = n - 1
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user