How do I combine string variables?

Need help with any SMBX game-related issues? Ask your questions here.
AiriableConditions
Shy Guy
Shy Guy
Posts: 6
Joined: Wed Feb 17, 2021 8:11 am
Pronouns: he, him
Contact:

How do I combine string variables?

Postby AiriableConditions » Sat Dec 30, 2023 4:12 pm

I'm planning to make something where the player inputs letters in an order to form a level's name, which will then be loaded with each letter as a variable, but I can't figure out how to combine string variables (a variable for each letter.)

Example: "level" combined with ".lvlx" to make "level.lvlx"

I've tried doing table variables, such as {"level",".lvlx}, and I've also tried to use + to combine the string variables, such as Level.load("level"+".lvlx"), since that works in other programs, but it always gave me an error trying to load it.

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9722
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: How do I combine string variables?

Postby Emral » Sat Dec 30, 2023 6:22 pm

The lua concatenation operator is ..
"level" .. ".lvlx"


Return to “Help and Support”

Who is online

Users browsing this forum: No registered users and 2 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari