Skip to content
ConcordConcordConcord

List

Data structure that allows for fast removal at the cost of order.

If the concord folder is in the root directory of your game, you can import this module like so:

List = require('concord.list')

Iterate in order with ipairs(list) over indices 1..list.size. List() is equivalent to List.new().

Name Type Description
size integer Number of items in the List
Method Description
List.new Creates a new List.
List:add Adds an object to the List.
List:remove Removes an object from the List.
List:clear Clears the List completely.
List:has Returns true if the List has the object.
List:get Returns the object at an index.
List:indexOf Returns the index of an object in the List.
List:sort Sorts the List in place, using the order function.
List:onAdded Callback for when an item is added to the List.
List:onRemoved Callback for when an item is removed from the List.