I stumbled upon this in a Roblox wiki or something. What does it mean?
array[16][12] of 16-bit intergers
Brackets are the "actual" access operators in Lua.
The dot .
access operator is typically used in place of string-indexes with the brackets:
Table.thing --is equivalent to Table["thing"]
What that code is doing is using the array
Table, and accessing the 16th member of that, which is also a Table, and then accessing the 12th member of it.
-- Simple version: local array = {} array[16] = {} array[16][12] = 255 -- Common version: local array = {} for n=1,16 do array[n] = {} end array[16][12] = 255 -- Simple type declaration: Array2 = { new = function(rows,columns) local array = {} for x=1,rows do array[x] = {} for y=1,columns do array[x][y] = 0 end end return array end, } array = Array2.new(16,12) array[16][12] = 255
By the way, a "array[16][12]" is a 2-dimensional array (grid) with the dimensions 16,12 (Like the code above shows: A table with 16 elements, with the value of every element set to another table with 12 elements, with the value of every element set to 0. Lua however doesn't make a difference between ints, float, doubles or bytes. In Lua these are all called "numbers", and thus a array[16][12] of 16-bit integers is basicly a array[16][12] of numbers, with all default values set to full numbers between 0 and 65535, and assuming you will not set any value that's not a full number or is below 0/above 65535.