VERY nooby question

Hello, I’m a beginner at Lua, so please don’t be harsh.

I’m wondering what’s wrong with this;

[lua]
myTable={}
myTable[1] = “TeoTown”
myTable[2] = “is AWESOME!”
myTable[3] = “is NOT awesome!”

if Player:Nick() == “TeoTown” then
Msg (myTable[1] … myTable [2])
else
Msg (myTable[1] … myTable [3])
end
[/lua]

I keep getting this error messege in my console when I try to run it.

[lua\helloworld.lua:7] attempt to index global ‘Player’ (a function value)

Halp

you haven’t defined “Player” on line 6.

try something like:

[lua]
local myTable={}
myTable[1] = “TeoTown”
myTable[2] = “is AWESOME!”
myTable[3] = “is NOT awesome!”

for k, v in pairs( player.GetAll() )
if v:Nick() == “TeoTown” then
Msg (myTable[1] … myTable [2])
else
Msg (myTable[1] … myTable [3])
end
end
[/lua]

I’ll try to learn of that, thanks for the reply.

You could just replace player with ply and hook it.
Would be better for those who are just starting, for looping can become complicated.

[LUA]myTable={}
myTable[1] = “TeoTown”
myTable[2] = “is AWESOME!”
myTable[3] = “is NOT awesome!”

function TeoIsAwesome(ply)
if ply:Nick() == “TeoTown” then
Msg (myTable[1] … myTable [2])
else
Msg (myTable[1] … myTable [3])
end
end
hook.Add(“PlayerInitialSpawn”, “IsTeoAwesome”, TeoIsAwesome)
[/LUA]

You don’t need to replace Player with ply. . .