Language:EN
Pages: 2
Rating : ⭐⭐⭐⭐⭐
Price: $10.99
Page 1 Preview
containing string set the index index string print

Containing string set the index index string print

194 6. INTEGRATION: USING EXISTING SCRIPTING SYSTEMS

Neat, huh? Lua automatically created and initialized indexes 24 and 512, allowing you to access them without any sort of out-of-bounds or access-violation errors. In this regard, table indexes are much like typical Lua variables in that they are created only when they are first assigned (or when you initialize them with the { … } notation), but will contain nil until then.

The next important aspect of Lua tables is that they are heterogeneous, which means that not all indexes must contain the same type of value. For example:

LUA (AND BASIC SCRIPTING CONCEPTS) 195

Which will output the following:

NOTE

Even though I indexed MutliTable []
from 0 to 2, each of the other three-index tables that were directly initialized at
MultiTable [ 0 ], MultiTable [ 1 ], and so on, are indexed automatically 1 to 3 because of Lua’s one-index convention. I automatically use zero-indexing out of habit, but it’s definitely important to keep Lua’s style in mind. Forgetting this detail can lead to some nasty logic errors.

Enemy = {};
Enemy [ "Name" ] = "Security Droid";
Enemy [ "HP" ] = 200;

You are viewing 1/3rd of the document.Purchase the document to get full access instantly

Immediately available after payment
Both online and downloadable
No strings attached
How It Works
Login account
Login Your Account
Place in cart
Add to Cart
send in the money
Make payment
Document download
Download File
img

Uploaded by : Joseph Christian

PageId: ELIC80AFC5