Meta functions?

I don’t understand how does one create a meta function.
I tried to follow the code in player_auth.lua, placed the file in lua/autorun, and it didn’t work.
When that didn’t work I tried to edit player_auth.lua, but that STILL didn’t work.
I don’t get it - how do I create a meta function?



meta = FindMetaTable("Player") //OR something else

function meta:Test()

self:SetHealth(1000)

end


then you can use this like:



for k, v in pairs( player.GetAll() ) do v:Test() end


Something like this?

Ok so that’s exactly what I did.
So I think my problem is this:
How do I create a global meta function?

What do you mean by that?

Global.setmetatable

[editline]7th February 2016[/editline]

Make a table, as example, testtbl, then run setmetatable on it, for it to be global your table has to be a global valiue

For example meta:IsAdmin() can be called anywhere.
I want to make something like that

[editline]7th February 2016[/editline]

I’m already using “Player” though

That is exactly how they work.

My God I am just dumb.
I called the function test and ran it as Test.
It works, thanks facepalm