Game Development Community

Arrays no Work!

by Yue -Rookie Torque 3D- · in Torque 3D Beginner · 09/03/2013 (6:34 am) · 9 replies


$testArray[0,0] = "a";
$testArray[0,1] = "b";
$testArray[0,2] = "c";

echo($testArray[0,0]); // Error

About the author

http://www.iris3d.tk -Games Studios- <<I do not speak English: I use the google translator>> My goal as a rookie is knowing Torque 3D


#2
09/03/2013 (9:03 am)
my worst misfortune in the world of technology is being born in a developing country does not speak English pitch.
#3
09/03/2013 (9:10 am)
So what is your language then?
#4
09/03/2013 (9:32 am)
docs.garagegames.com/torque-3d/official/content/documentation/Scripting/Simple/A...
Look at that.

Also, arrayObject:
function myArrayObject()
{
if(!isObject($myarray))
   $myarray = new arrayobject();

%one = 1;
%y = "yee";
%three = 3;
%s = "say";
%five = 5;
%l = "look";
%seven = 7;
%b = "bot";

$myarray.add(%one, %y);
$myarray.add(%two, %s);
$myarray.add(%three, %l);
$myarray.add(%four, %b);

$myarray.echo();

$myarray.getKey(1);
//returns 2
$myarray.getValue(3);
//returns bot;
$myarray.getIndexFromValue(%s);
//returns 1;
}
#5
09/03/2013 (10:49 am)
@Steve Thanks Your for Sample code. :)

@Duion My languaje it's spanish, i am use google translator.

#6
09/03/2013 (11:14 am)
Tbh looking at the original code I have no clue why it didn't work for you:
==>$testArray[0,0] = "a";
a
==>echo($testArray[0,0]);
a
That worked fine for me, if the problem persists can I see your console log?
#7
09/03/2013 (3:37 pm)
Localization? Perhaps his computer is reading that as a floating point number (zero point zero) instead of two zeros separated by a comma (zero comma zero)?
#8
09/03/2013 (4:03 pm)
you can always loose the commas
the commas and brackets are throw away anyway.

$testArray00 = "a";
$testArray01 = "b";
$testArray02 = "c";

echo($testArray00);
#9
09/03/2013 (6:00 pm)
Apparently there are arrays of truth, has solved the problem, and the problem happens in my head trying to assimilate writing scripts.

Greetings.