Concatenation problem...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • arnaud
    Indigo Rose Customer
    • Aug 2003
    • 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
  • Corey
    Indigo Rose Staff Alumni
    • Aug 2002
    • 9745

    #2
    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

    Comment

    • arnaud
      Indigo Rose Customer
      • Aug 2003
      • 21

      #3
      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

      Comment

      • Corey
        Indigo Rose Staff Alumni
        • Aug 2002
        • 9745

        #4
        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

        Comment

        Working...
        X