Difference between revisions of "Table"

From PKC
Jump to navigation Jump to search
 
Line 8: Line 8:
123
123
</syntaxhighlight>
</syntaxhighlight>
<noinclude>
[[Category:Data type]]
</noinclude>

Latest revision as of 08:07, 9 August 2021

Table in Lua is a kind of associative array, one can see its example here:

t = {}
t["foo"] = 123 -- assign the value 123 to the key "foo" in the table
t[3] = "bar" -- assign the value "bar" to the key 3 in the table
= t["foo"]
123