PDA

View Full Version : Concatenation problem...



arnaud
02-01-2004, 09:31 AM
Hello,

In my project, I've variables bx (b1, b2, b3, etc...), containing "number" values.

I want to call their variables in "for...do" statements:
for x = 1, 200 do
result = "b"..x
end

In that example, the variable "result" is a string.
How can I make "result" has the value stored in bx ?

Thank you,

Arnaud

Corey
02-01-2004, 03:30 PM
Hi. try using a table.

b = {};
b[1] = "apple";
b[2] = "orange";
x = 2;
Dialog.Message("", b[x]);

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

arnaud
02-01-2004, 04:46 PM
Hi Corey,

Thank you for your answer!

Yes, using a table works fine. It was what I was thinking about, but I wanted to know if there was another way to do it...
;)

Thank you!

Arnaud

Corey
02-01-2004, 05:40 PM
FWIW This is exactly what tables are for so that's the best solution, although I'm sure there are other ways, they would likely be less efficient.

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)