Login / Registrieren
DE EN FR ES IT CZ
Zurück Nach oben

Lua string variables question [SOLVED]

  • #1, by red363 2 years ago Zitieren
    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

  • #2, by afrlme 2 years ago Zitieren
    Do you mean string concatenation, where you amend more text to the end of the existing text?
  • #3, by red363 2 years ago Zitieren
    Do you mean string concatenation, where you amend more text to the end of the existing text?

    Yes
  • #4, by red363 2 years ago Zitieren
    seems to figure it out:

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

  • #5, by afrlme 2 years ago Zitieren
    Aye, that's correct, but feel free to use shorthand instead of the old longhand getObject method.

    Values["name"].String = Values["name"].String .. "example"
  • #6, by red363 2 years ago Zitieren
    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