Remove multiple elements from an array in Lua

In Lua, I know there is

table.remove(array, index)

      

Is there a quick way to remove and return X elements from an array (without repeated calls to table.remove)?

+3


source to share


1 answer


Not; The API does not delete or return multiple items from a table. You can use table.remove

, array[index] = nil

or dump array

to an empty table and repopulate (if you have majority elements).



+2


source







All Articles