-
Notifications
You must be signed in to change notification settings - Fork 8
Lua Goodies
Levi Webb edited this page May 15, 2015
·
3 revisions
There's a few goodies that are added to computers that normally don't exist with Lua.
(since version 1.8-alpha
)
Static arrays are like primitive arrays in Lua (which don't normally exist!). You can treat them like accessing a table with integral keys (myArray[1]
, myArray[2]
etc), however:
- arrays cannot be resized
- arrays cannot have non-numerical keys
- arrays are not compatible with tables (
{
,}
syntax and thetable
library). - arrays are a unique type (
static_array
)
You can create a static array using the following code:
myArray = static_arr(16)
which will create an array of size 16.
(since version 1.8-alpha
)
There's a small library called list
that you can use, it contains an implementation of a resizeable list in lua and a few helper functions. Check out its source code on a computer by opening /lib/list
!