Advertisement
alestane

Splicing an array

Mar 4th, 2013
405
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.17 KB | None | 0 0
  1. function table.removeMany(t, i, j)
  2.     j = j or #t
  3.     local offset = j - i
  4.     for n=j+1, #t do
  5.         t[n - offset] = t[n]
  6.     end
  7.     for n = #t - offset, #t do
  8.         t[n] = nil
  9.     end
  10. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement