where do i go to learn how to use metatables?

I’ve been looking for some tutorials or examples with gmod but i need some help.
could someone point me in the right direction?
:v:???

was it really that hard

every time i post i feel stupid, i have horrible luck. thank you for that and thank you for EVOLVE its very nice.

There isn’t a very good all-in-one tutorial. I had to read 3 different tutorials before I really knew everything I wanted to know.

I’m no good with tutorials, I can only work with examples.
So here’s an example:
[lua]
local meta = getmetatable(“Player”)
function meta.HelloWorldChatPrint(self,name)
self:ChatPrint("Hello World! I am "…name)
end

// Exactly the same function, except simplified. You don’t really have to do this, this is just for example purposes.
function meta:HelloWorldChatPrint(name)
self:ChatPrint("Hello World! I am "…name)
end

// Now we put those functions into use.
function SpawnHooky( plyer )
plyer:HelloWorldChatPrint(“God”)
end
hook.Add(“PlayerSpawn”,“HookyBooky”,SpawnHooky)
// Now whenever a person joins, “Hello World! I am God” will print in their chatbox.

[/lua]

You mean FindMetaTable, not getmetatable. Also, make the SpawnHooky function local, you don’t need it anywhere else.

I use _R, and never getmetatable nor FindMetaTable, so I forgot the function name before writing it out. x.x

getmetatable is not the same as _R or FindMetaTable.

Instead of using name you can use self:Nick() to get the players name.