Numeric Variable added to a text body

I am new to Lua and not that familiar with it yet…

I know with Java, if you wanted to add a variable to a println, you would use a ‘+’

ex: System.out.println("Hello world, my name is: "+name);

How would I do that in Lua?

I have a line that says:

body = "Your total is: "

and I have a numeric variable named total.

How do I add them?

Thanks!

Hi,

To join strings, you need to use “…” - and you can also force the number into a string using tostring( ).

So you’ll need

print("Your total is: " .. tostring( total ) )

Cheers,

Simon

Dixon Court Entertainment

Thanks!

Hi,

To join strings, you need to use “…” - and you can also force the number into a string using tostring( ).

So you’ll need

print("Your total is: " .. tostring( total ) )

Cheers,

Simon

Dixon Court Entertainment

Thanks!