Lua Help Please

I just started Lua, and it’s going kinda well so far.
I’m reading the GMOD Wiki Lua tutorials.
I made this script

[lua]Name=PointWezt
myName=WeztPoint
Msg(“Hello “…myName…”!/n”)
Msg(“How are you today “…Name…”?/n”)
Msg(“Hope you’re having fun, “…myName…”!/n”)
Msg(“If you aren’t having fun “…Name…”, go play another game!/n”)[/lua]

And it’s supposed to write something in console, but i get this error message "
Running script multiplevariables.lua…
multiplevariables.lua:3: attempt to concatenate global ‘myName’ (a nil value)"

So, please help me.
I would prefer an explanation, not just a solution. Thanks in advance!

By the way, what’s that code tag called? It’s not


 [/ code]. You know, the one with the numbers on the side.

Name and myName are holding nil values because you forgot to put PointWezt and WeztPoint in quotation marks to make them strings.

[lua]local Name = “PointWezt”
local myName = “WeztPoint”
Msg(“Hello “…myName…”!/n”)
Msg(“How are you today “…Name…”?/n”)
Msg(“Hope you’re having fun, “…myName…”!/n”)
Msg(“If you aren’t having fun “…Name…”, go play another game!/n”)[/lua]

also, I suggest making them local so they are only accessible from this file.

The tag you’re looking for is [noparse][lua][/lua][/noparse]

Thanks dude!
That worked, thanks for explaining it, too.

[editline]06:21PM[/editline]

Now the linebreaks don’t work.
Console just prints this:

“Hello WeztPoint!/nHow are you today PointWezt?/nHope you’re having fun, WeztPoint!/nIf you aren’t having fun PointWezt, go play another game!/n”

Not sure if it works, but you can try using print instead of Msg?

Wouldn’t that cause it to say it in the chat?
Trying it anyway.

They do the same thing.

[editline]05:56PM[/editline]

not /n

Nope, I get an error when using Print.

Shouldn’t capitalize it. And yeah, I didn’t notice that one, MakeR. You have the slash the wrong way.

FFFFF-

Trying that :geno:

[editline]07:06PM[/editline]

It worked.

Thanks for the help guys.

[editline]07:20PM[/editline]

[lua]local age = 14
local age1 = 19
if age < 15 then
Msg ("Sorry Wezt, you gotta be atleast 15. You’re only “…age…”. Come back when you are over 15.
“)
elseif age1 > 18 then
Msg (“You’re over 18. In fact, you are “…age1…”. Too bad, huh?
“)
else
Msg (“Welcome to High School! You’re over”…age…”, and under”…age1…”. That way you can enter High School!
")
end[/lua]

Made another code, don’t know if it will work.
I read the tutorial on GMOD wiki.

[editline]07:29PM[/editline]

Yeah, it worked.