Array Module

The array module allows for the creation of memory efficient arrays that can easily be serialized to a string. A Lua table uses far more memory per element than an array, especially when the array is used to store 8, 16, or 32-bit values. All numerical values in a Lua table are stored as 64-bit double precision numbers and a table also requires additional memory overhead to store the value.

Once an array has been created, the values can be accessed just as they can be with a Lua table. All values in the array are initialized to 0 when the array is created..

Example

arr = Array.new(1000, "int32")
for i=1,1000 do arr[i] = i end