Module:array/documentation

Returns an array constructor that produces a table that has a number of functions available as methods: the  library functions, and various vanilla Lua functions and functions from Module:table and Module:fun that operate on arrays or on tables with integer keys.

The functions from Module:table and Module:fun are loaded as needed.

Functions from Module:table: Functions from Module:fun. These have a function as the second argument (first argument of method): These functions are included in a  subtable of an array (awkward): The following functions return an array (with the array metatable):
 * (alias ), ,  ,  ,  ,   (alias  ),  ,  ,  ,  ,  ,  ,

The names with underscores instead of camel case can be used as aliases: for instance,  instead of.

The array constructor behaves differently depending on the arguments supplied to it. Without arguments, it creates an empty table. Given a single table, it adds the metatable to it. If the table has been loaded with, it duplicates the table, removing the metatable that is found in tables loaded with. Otherwise, it creates a new table (array) containing the arguments.

The array constructor does this by adding a metatable. This is similar to how all strings have a metatable that allows the  library functions to be used as methods: for instance,   for.