alestane icon

Splicing an array

alestane | PRO | 03/05/13 12:56:02 AM UTC | 0 ⭐ | 536 👁️ | Never ⏰ | []
Lua |

170 B

|

None

|

0 👍

/

0 👎

function table.removeMany(t, i, j)
    j = j or #t
    local offset = j - i
    for n=j+1, #t do
        t[n - offset] = t[n]
    end
    for n = #t - offset, #t do
        t[n] = nil
    end
end

Comments