PDA

View Full Version : Scripting Reference Question


Jim Smiley
11-11-2003, 01:12 PM
Hi all;

Just FYI, the only thing I know about scripting is what I learned in this document.

In the example on page 34 of the "Scripting Reference", why do j & k represent the table index & value? Are these universal variables? I could find no other mention of this in the document.


Regards;

Jim Smiley

TJ_Tigger
11-11-2003, 01:29 PM
Those are the variables that were chosen for that example. The for loop that they use enumerates a table and the "j" and "k" variables were used just for that example. The syntax is

for index, value in table do
operate on index and value
end

Code from scripting guide
-- display a message for every table item
for j,k in mytable do
Dialog.Message("Table Item", j .. "=" .. k);
end

for the variable index they used "j" and for the variable at value, they used "k". They could have just as easily done this

for index, value in mytable do
Dialog.Message("Table Item", index .. "=" .. value);
end

HTH

Jim Smiley
11-11-2003, 02:09 PM
Thanks Tigger;

Now I understand. I guess I just needed a little more explanation.

Having completed the "Getting Started " Tutorial and the "Scripting Reference" I just wish to say that you guys have done a great job on AMS5. It will add functionality to my projects that I never dreamed I'd be able to provide.

I've ordered my upgrade and can't wait for the 14th.

Regards;

Jim Smiley