# Array length operator

The length operator # applied on a Array object returns its memory size in bytes.

Notes

  • The length operator returns the same result as the Array.size property.

Example

local c = require 'c' -- Defines a C array with 3 rows of 4 chars local CharArray = c.Array("c", 3, 4) -- Creates a new CharArray with an initialization table local array = CharArray { { "a", "b", "c", '\0' }, { "d", "e", "f", '\0' }, { "g", "h", "i", '\0' } } -- prints the size of "array" in memory (3x4 elements of 1 bytes) print(#array)