Which Environment should i use?

I don’t know about any except _G and _F


CMP.Groups = {
	superadmin = 0,
	developer = 1,
	admin = 2,
	moderator = 3,
	vip = 4,
	user = 5,
}

CMP.CanUse = function(ply,check)
	local group = string.lower(ply:GetUserGroup())
	
	if table.HasValue( CMP.Groups,[group]) and table.HasValue(CMP.Groups,[string.lower(check)]) then
		return CMP.Groups[string.lower(group)] >= CMD.Groups[string.lower(check)]
	else
		CMP.Error("Group not existent", "Added Groups: "..group.." and "..check)
	end
end

=> …cmdbase.lua:30: unexpected symbol near ‘[’
Line 30 is


if table.HasValue( CMP.Groups,[group]) and table.HasValue(CMP.Groups,[string.lower(check)]) then

Now, i do know i need some environment as [stuff] only works with tables but which should i use? _G doesn’t work obviously.

What i am trying to do is:

Get the players group (e.g. superadmin) and then make a variable with the value of the variable group which is the players group so a variable is created such as superadmin and then
check if the group exists in the CMP.Groups table.

Any ideas?
Thanks!

You don’t need the around group and shouldn’t need it around string.lower(check)

How am I supposed to make a variable then?

Edit:
Fixed it.
For anybody who needs such:


CMP.CanUse = function(ply,check)
	local group = string.lower(ply:GetUserGroup())
	
	if CMP.Groups[group] then
		return CMP.Groups[group] >= CMD.Groups[string.lower(check)]
	else
		CMP.Error("Group not existent", "Added Groups: "..group)
	end
end