Andromo - Start Making Apps - Free Signup

Announcement

Collapse
No announcement yet.

Concatenation problem...

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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


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


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