Scripting in LUA: PART 3 [Arrays…

Cheryl Abram
2 min readJul 20, 2022

If you shop at Walmart, Target or any grocery story, you have intimate knowledge of an array. An array is a list that stores things in some order. When you’re in line, you wouldn’t dream of cutting in front of the person in front of you, right? And you have one eye on the person behind you to be sure they stay in their place.

In PART 1 I talked about variables as a place to store information. In the example I said my name (Cheryl) is the variable and inside the variable is my 4-page resume. Well, I’m not going to ask people to call me by all the information on my resume, they can just call me by my variable — Cheryl.

NOTE: In Ruby a variable is called a ticket!

I’ve discovered that programming is mostly working with variables.

VARIABLES STORE VALUES. They are called variables because they are a collection of values that vary, meaning, they can have a variety of values.

Imagine a dimmer switch where you can vary the amount of light by turning it left or right.

However, a value is a thing that never changes, like the number 42, the leter Z or the sequence of letters in my name, “Cheryl”.

In PART 2 I said a function is a block of code that does something.

When you call a function you are telling the computer to run (or execute) that set of actions.

I’m also aware that programmers give lots of attention to the currency of computing — MEMORY. They will use things like variables to avoid using too many strings too many times and spending alot of precious memory.

Anything that will save a little memory is worth using.

More to come!!

--

--