Over 10 Million Study Resources Now at Your Fingertips


Download as :
Rating : ⭐⭐⭐⭐⭐
Price : $10.99
Language:EN
Pages: 2

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;

How It Works
Login account
Login Your Account
Add to cart
Add to Cart
Payment
Make payment
Document download
Download File
PageId: ELIC80AFC5
img
Uploaded by :
qLRbRbXM
Page 1 Preview
containing string set the index index string print
Sell Your Old Documents & Earn Wallet Balance