Monday, February 4, 2002

Phil wrote, “No arrays in UserTalk?”

We have arrays. We call them lists. Here’s a list of integers:

{1, 2, 3, 4, 5}

You can add lists together if you want:

{1, 2, 3} + {4, 5} == {1, 2, 3, 4, 5}

You can reference them by index:

local (aList = {1, 2, 3});<br /> aList[2] = 4;

After running the above, aList will contain {1, 4, 3}.

You can also mix types:

{1, "two", 0x03}

And you can nest lists:

nestedList = {1, 2, {3.0, 3.5}, 4}

In the above example, nestedList[2][1] has a value of 3.0.