![]() | |||||||||
| |||||||||
Lua-ApiTable |
[LUA 5.1] table
Lua's Tables are associative arrays. The element table contains all original lua table functions. Tables are always passed by reference. If you really want to copy a table, you need to copy all its content. To initialize a table in lua one uses {}. Code mytable={} As its an associative array (also known as map), you can set values in this table. Code mytable={} Because of syntatic sugar you can also access the value of the "name"-field by the following construct. Code print(mytable.name) -- My Table In that way you can access and address values in a table. To view all keys and its values in a table, you can use the following code snippet. Code for key,value in pairs(mytable) do If you don't want to set the key and just want to append the value to the table, you can use table.insert. Code mytable={} Comments |
||||||||
| © 2007 DracoBlue :: Valid XHTML, CSS, RSS Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC | SourceNet © 2007, DracoBlue :: Page created in 0.265 seconds with 54 queries. | |||||||||