C-Arrays

A rather new addition is the --!carrays macro. This macro forces the first element in arrays to start at 0 not 1 like usual. This macro was added for all those C-style programmers (and others) who can't stand this feature about Lua. The following code segment shows this macro in action:

--!carrays

local array: Array<number> = { 1, 2, 3 }

print(array[0])    -- Gets first element (1)
print(array[1])    -- Gets second element (2)

Last updated