=head1 NAME table - table manipulation functions (standard library) =head1 OVERVIEW This library provides generic functions for table manipulation. It provides all its functions inside the table C. Most functions in the table library assume that the table represents an array or a list. For these functions, when we talk about the "length" of a table we mean the result of the length operator. =head2 C table.concat (table [, sep [, i [, j]]]) Returns C. The default value for C is the empty string, the default for C is 1, and the default for C is the length of the table. If C is greater than C, returns the empty string. =head2 C table.insert (table, [pos,] value) Inserts element C at position C in C
, shifting up other elements to open space, if necessary. The default value for C is C, where C is the length of the table (see sect 2.5.5), so that a call C inserts C at the end of table C. =head2 C table.maxn (table) Returns the largest positive numerical index of the given table, or zero if the table has no positive numerical indices. (To do its job this function does a linear traversal of the whole table.) =head2 C table.remove (table [, pos]) Removes from C
the element at position C, shifting down other elements to close the space, if necessary. Returns the value of the removed element. The default value for C is C, where C is the length of the table, so that a call C removes the last element of table C. =head2 C table.sort (table [, comp]) Sorts table elements in a given order, I, from C to C, where C is the length of the table. If C is given, then it must be a function that receives two table elements, and returns true when the first is less than the second (so that C will be true after the sort). If C is not given, then the standard Lua operator C<<> is used instead. The sort algorithm is not stable; that is, elements considered equal by the given order may have their relative positions changed by the sort. =head1 VERSION This is Lua version 5.1.1. =head1 CREDITS Lua is developed at Lua.org, a laboratory of the Department of Computer Science of PUC-Rio (the Pontifical Catholic University of Rio de Janeiro in Brazil). For more information about the authors, see http://www.lua.org/authors.html . =head1 LICENSE Lua is licensed under the terms of the MIT license reproduced below. This means that Lua is free software and can be used for both academic and commercial purposes at absolutely no cost. For details and rationale, see http://www.lua.org/license.html . ~~~~~ Copyright (C) 1994-2006 Lua.org, PUC-Rio. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ~~~~~