Lua string variables question [SOLVED]

  • #1, by red363Monday, 12. June 2023, 09:01 11 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 2023, 22:57 11 months ago
    Do you mean string concatenation, where you amend more text to the end of the existing text?

    Imperator

    7278 Posts

  • #3, by red363Tuesday, 13. June 2023, 16:20 11 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 2023, 16:58 11 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 2023, 21:07 11 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

    7278 Posts

  • #6, by red363Tuesday, 13. June 2023, 21:22 11 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