Module jls.util.TableList
Represents an array.
Class TableList
TableList:new () | Creates a new TableList. |
tableList:add (value) | Adds a new element at the end of this list. |
tableList:remove (index) | Removes the element at the specified index. |
tableList:removeFirst (value) | Removes the first specified value from this list. |
tableList:removeLast (value) | Removes the last specified value from this list. |
tableList:removeAll (value) | Removes the specified value from this list. |
tableList:insert (index, value) | Inserts a new element to this list at the specified index. |
tableList:size () | Returns the size of this list. |
tableList:join ([sep[, i[, j]]]) | Returns a string by concatenating all the values of the specified list. |
TableList.removeFirst (list, value) | Removes the first specified value from the specified list. |
TableList.removeLast (list, value) | Removes the last specified value from the specified list. |
TableList.removeAll (list, value) | Removes the specified value from the specified list. |
TableList.join (list[, sep[, i[, j]]]) | Returns a string by concatenating all the values of the specified list. |
TableList.isName (value) | Returns true when the specified value is a Lua name. |
TableList.isList (t[, withHoles[, acceptEmpty]]) | Returns true when the specified table is a list. |
Class TableList
A TableList class.
- TableList:new ()
- Creates a new TableList.
- tableList:add (value)
-
Adds a new element at the end of this list.
Parameters:
- value The element to add at the end of this list.
Returns:
-
jls.util.TableList
this list.
- tableList:remove (index)
-
Removes the element at the specified index.
Parameters:
- index integer The index of the element to remove.
Returns:
-
The value of the removed element.
- tableList:removeFirst (value)
-
Removes the first specified value from this list.
The matching values are found using equality (==)
Parameters:
- value The value to remove from the list.
Returns:
-
boolean
true if a value has been removed.
- tableList:removeLast (value)
-
Removes the last specified value from this list.
Parameters:
- value The value to remove from the list.
Returns:
-
boolean
true if a value has been removed.
- tableList:removeAll (value)
-
Removes the specified value from this list.
Parameters:
- value The value to remove from the list.
- tableList:insert (index, value)
-
Inserts a new element to this list at the specified index.
Parameters:
- index integer The index where to insert the element.
- value The element to insert to this list.
Returns:
-
jls.util.TableList
this list.
- tableList:size ()
-
Returns the size of this list.
Returns:
-
integer
the size of this list.
- tableList:join ([sep[, i[, j]]])
-
Returns a string by concatenating all the values of the specified list.
tostring() is used to get the string of a value.
Parameters:
- sep string An optional separator to add between values. (optional)
- i integer The index of the first value, default is 1. (optional)
- j integer The index of the last value, default is #list. (optional)
Returns:
-
string
a string with all values joined.
- TableList.removeFirst (list, value)
-
Removes the first specified value from the specified list.
Parameters:
- list table The list from which to remove the value.
- value The value to remove from the list.
Returns:
-
boolean
true if a value has been removed.
- TableList.removeLast (list, value)
-
Removes the last specified value from the specified list.
Parameters:
- list table The list from which to remove the value.
- value The value to remove from the list.
Returns:
-
boolean
true if a value has been removed.
- TableList.removeAll (list, value)
-
Removes the specified value from the specified list.
Parameters:
- list table The list from which to remove the value.
- value The value to remove from the list.
- TableList.join (list[, sep[, i[, j]]])
-
Returns a string by concatenating all the values of the specified list.
tostring() is used to get the string of a value.
Parameters:
- list table The list of values to concatenate.
- sep string An optional separator to add between values. (optional)
- i integer The index of the first value, default is 1. (optional)
- j integer The index of the last value, default is #list. (optional)
Returns:
-
string
a string with all values joined.
- TableList.isName (value)
-
Returns true when the specified value is a Lua name.
Names in Lua are any string of letters, digits, and underscores, not beginning with a digit and not being a reserved word.
Parameters:
- value string The string value to check.
Returns:
-
boolean
true when the specified value is a Lua name.
- TableList.isList (t[, withHoles[, acceptEmpty]])
-
Returns true when the specified table is a list.
A list has continuous integer keys starting at 1.
Parameters:
- t table The table to check.
- withHoles boolean true to indicate that the list may have holes. (optional)
- acceptEmpty boolean true to indicate that the list could be empty. (optional)
Returns:
- boolean true when the specified table is a list.
- number the number of fields of the table.