Consequently, are Lua arrays 0 indexed?
Lua libraries prefer to use indices which start at 1. However, you can use any index you want. You can use 0, you can use 1, you can use -5.
Also Know, are strings arrays in Lua? Lua uses associative arrays and which can be indexed with not only numbers but also with strings except nil. When we access a method string.
Thereof, how do I add items to an array in Lua?
To add a new value to an array, use table.insert(array, valueToInsert) . The second parameter can be any type of value such as a string, number, or even a Player object. This example will add an item to a player's inventory array when they've touched a part.
How do I return an array in Lua?
To return multiple values, simply return an array. Returning a single value that is not an array will automatically be treated as an array with a single value. Should you wish to return an array to Lua, simply wrap that value inside another array. This would, however, return the value to Lua as userdata (see above).