Author Topic: Get Chosen Array Value  (Read 426 times)

Here is my function:
Code: [Select]

//Quality Bricks
$qualityBrickDB[336,6000];

if($qualityBrickDB = %brick.getDatablock()) {
echo($qualityBrickDB.selected);
}


How could i grab the chosen value in the array
« Last Edit: June 07, 2011, 06:55:53 PM by tyler0 »


TorqueScript doesnt use traditional arrays, they are all just variable names

$Array[1] = "Line1";
$Array2 = "Line2";

echo($Array1);
echo($Array[2]);

prints:
Line1
Line2


so in your case, you will use something like:
if ($qualityBrickDB[%a] = %brick.getDatablock() )
  {
   echo($qualityBrickDB[%a] );
  }

So this "%a" variable could represent 336 and 6000? Then it would echo out the correct on?

So this "%a" variable could represent 336 and 6000? Then it would echo out the correct on?
no, a variable only gets 1 value.

why are you trying to use a 2d array?