https://developer.roblox.com/en-us/resources/release-note/Release-Notes-for-407
Am I missing something important?
https://developer.roblox.com/en-us/resources/release-note/Release-Notes-for-407
Am I missing something important?
I’ve just appended table.join. This should come in handy for a few of you.
(I’d have used “table.concat” like how C# uses, but in lua that serves as something else already)
Having functions to rotate a table or reverse it would be nice too.
local function rotateLeft(tbl,amount,i,j)
i = i or 1
j = j or #tbl
for _=1,amount or 1 do
table.insert(tbl,j,table.remove(tbl,i))
end
end
local function rotateRight(tbl,amount,i,j)
i = i or 1
j = j or #tbl
for _=1,amount or 1 do
table.insert(tbl,i,table.remove(tbl,j))
end
end
local function rotate(tbl,amount,i,j)
local l = amount < 0
return (l and rotateLeft or rotateRight)(tbl,l and -amount or amount,i,j)
end
-- (could improve these probably, so they're O(n) instead of O(n*amount))
local function reverse(tbl)
local length = #tbl
for i=1,length/2 do
local j = length-i+1
tbl[i],tbl[j] = tbl[j],tbl[i]
end
end