Searches a table to remove a specific element without an index
utils.inspect |
fast_remove(tbl, index) | Removes an item from an array in O(1) time. |
add_all(t1, t2) | Adds the contents of table t2 to table t1 |
index_of(t, e) | Checks if a table contains an element |
index_of_in_array(t, e) | Checks if the arrayed portion of a table contains an element |
contains(t, e) | Checks if a table contains an element |
array_contains(t, e) | Checks if the arrayed portion of a table contains an element |
set(t, index, element) | Adds an element into a specific index position while shuffling the rest down |
get_random_dictionary_entry(t, key) | Chooses a random entry from a table because this uses math.random, it cannot be used outside of events |
get_random_weighted(weighted_table, item_index, weight_index) | Chooses a random entry from a weighted table because this uses math.random, it cannot be used outside of events |
shuffle_table(t, rng) | Creates a fisher-yates shuffle of a sequential number-indexed table because this uses math.random, it cannot be used outside of events if no rng is supplied from: http://www.sdknews.com/cross-platform/corona/tutorial-how-to-shuffle-table-items |
clear_table(t, array) | Clears all existing entries in a table |
inspect | Similar to serpent.block, returns a string with a pretty representation of a table. |
size | Takes a table and returns the number of entries in the table. |
deep_copy | Creates a deepcopy of a table. |
merge | Merges multiple tables. |
equals | Determines if two tables are structurally equal. |
Removes an item from an array in O(1) time.
The catch is that fast_remove doesn't guarantee to maintain the order of items in the array.
Parameters: