MetaTables and IsAdmin

Well, what i’m trying to do is return true in the IsAdmin() function for my admin mod, what i’ve got so far is.
[lua]function _R.Player:IsAdmin()
return (self:GetNWString(“rank”) == “superadmin” or self:GetNWString(“rank”) == “owner” or self:GetNWString(“rank”) == “admin” )
end
[/lua]
When i print the GetNWString(“rank”) it works fine, any ideas?

Try doing something like
[lua]
local a = FindMetaTable(“Player”)

function a:IsAdmin()
return (self:GetNWString(“rank”) == “superadmin” or self:GetNWString(“rank”) == “owner” or self:GetNWString(“rank”) == “admin” )
end
a = nil
[/lua]

Alright, will try that now.

FindMetaTable(string) should be equivalent to _R[string] as far as I’m aware so they should be equivalent.
You haven’t actually said what went wrong with the code you had.

-snip-

Actually no since the : does that

] lua_run_cl print(FindMetaTable(“Player”) == _R.Player)
true

Yep, you’re right. Doing what I said wouldn’t have any effect.

What went wrong was - Didn’t return true when i checked if IsAdmin() returned true on me, when i set myself as an admin in ply:SetNWString(“rank”)

[editline]07:00PM[/editline]

Hm. It works fine now, but it’s a bit hooky.