Lua Programming/How to Lua/box

Referencing table elementsEdit

The box brackets can be used as an alternative syntax for referencing table elements:

print (student["age"])    -- equivalent to: print (student.age)
Last modified on 1 March 2011, at 00:45