Lua string variables question [SOLVED]

  • #1, z red363Monday, 12. June 2023, 09:01 hodinky A year 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

    Fanoušek fóra

    101 Posts


  • #2, z afrlmeMonday, 12. June 2023, 22:57 hodinky A year ago
    Do you mean string concatenation, where you amend more text to the end of the existing text?

    Imperátor

    7285 Posts

  • #3, z red363Tuesday, 13. June 2023, 16:20 hodinky A year ago
    Do you mean string concatenation, where you amend more text to the end of the existing text?

    Yes

    Fanoušek fóra

    101 Posts

  • #4, z red363Tuesday, 13. June 2023, 16:58 hodinky A year ago
    seems to figure it out:

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

    Fanoušek fóra

    101 Posts

  • #5, z afrlmeTuesday, 13. June 2023, 21:07 hodinky A year 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"

    Imperátor

    7285 Posts

  • #6, z red363Tuesday, 13. June 2023, 21:22 hodinky A year 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

    Fanoušek fóra

    101 Posts