table
A key/value container.
A new table can be created with brackets syntax:
local table1 = {} // empty table
local table2 = { a = 1, b = "hello", c = 5.57 }
Assigning a value to a non-existent key results in an error:
table1.foo = "bar" // AN ERROR HAS OCCURED [the index 'foo' does not exist]
In this case use the "new slot" operator:
table1.foo <- "bar" // OK
Tables can be iterated using foreach:
foreach(key, value in table) {
// use key or value
}
Methods
clear() |
removes all key/value pairs from the table |
keys() |
returns an array containing all keys from this table |
len() |
returns the number of key/value pairs in this table |
values() |
returns an array containing all values from this table |
Method Documentation
Removes all key/value pairs from the table
Returns an array containing all keys from this table
Returns
Returns the number of key/value pairs in this table
Returns
Returns an array containing all values from this table
Returns
This work is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.