Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2003
    Location
    Strasbourg, FRANCE
    Posts
    21

    Concatenation problem...

    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

  2. #2
    Corey is offline Indigo Rose Staff Alumni
    Join Date
    Aug 2002
    Posts
    9,746
    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

  3. #3
    Join Date
    Aug 2003
    Location
    Strasbourg, FRANCE
    Posts
    21
    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

  4. #4
    Corey is offline Indigo Rose Staff Alumni
    Join Date
    Aug 2002
    Posts
    9,746
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts