Lua string variables question [SOLVED]

  • #1, by red363Monday, 12. June, 09:01 3 months ago
    Hello!

    Is it possible to add a string value to string values?
    For example, Values[char].String = "name1".
    I want to add the values "name2", "name3", etc. to this and end up with vs=char:

    name1, name2, name3, etc. (in the same variable)

    Thanks

    Forum Fan

    101 Posts


  • #2, by afrlmeMonday, 12. June, 22:57 3 months ago
    Do you mean string concatenation, where you amend more text to the end of the existing text?

    Imperator

    7265 Posts

  • #3, by red363Tuesday, 13. June, 16:20 3 months ago
    Do you mean string concatenation, where you amend more text to the end of the existing text?

    Yes

    Forum Fan

    101 Posts

  • #4, by red363Tuesday, 13. June, 16:58 3 months ago
    seems to figure it out:

    local a = getObject("Values[name]")
    a.String = a.String .."name2"

    Forum Fan

    101 Posts

  • #5, by afrlmeTuesday, 13. June, 21:07 3 months ago
    Aye, that's correct, but feel free to use shorthand instead of the old longhand getObject method.

    Values["name"].String = Values["name"].String .. "example"

    Imperator

    7265 Posts

  • #6, by red363Tuesday, 13. June, 21:22 3 months ago
    Aye, that's correct, but feel free to use shorthand instead of the old longhand getObject method.

    Values["name"].String = Values["name"].String .. "example"

    Ok, Thanks

    Forum Fan

    101 Posts

Write post