Any Functions

This lua doesn’t work:

xxx=Alex
if xxx==Alex
then Msg(“UR ALEX!”)

Or, would this have to be a Function (xxx)
Can it be this?:

xxx=Alex
Msg(“Hi,”…xxx…", what ya doin’?")

Because myName doesn’t sound like a real function, thats why I thought you could make one up:

xxx=alex

Now it knows xxx=alex, right?

So if I do this Msg(Hi,"…xxx…", what ya doin’?")

It knows to replace xxx with alex and put it together to make it:

Hi, Alex, what ya doin’?

Correct?

(P.S., How do you make a message appear in chat instead of console?)


function sayHello (name)
sayHello == Alex
print (“Hello,”…name…"!")
end

Would that work?
And can someone please answer?

i think you mean something like this
[lua]function sayHello(name)
print("Hello, " … name … “!”)
end
[/lua]

then use it like

sayHello(“alex”)

In this snippet you forgot an end.


xxx = Alex
if xxx == Alex then
	Msg("YOU'RE ALEX!")
end

errr
don’t you mean
[lua]xxx = “Alex” – its a string :smiley:
if xxx == Alex then
Msg(“YOU’RE ALEX!”)
end[/lua]

if xxx == “Alex” then

You’re right, I was focusing on the missing end.