Give the role methods an explicit self

emmylua takes self from the owner table, so `@param self ExpRoles.Role`
only applies with dot syntax. Call sites still use a colon.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
bbassie
2026-08-07 15:31:18 +00:00
co-authored by Claude Opus 5
parent 19fd1eabbe
commit 4745b6de0b
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -200,7 +200,7 @@ function Roles.debug()
local output = ""
for index, role_name in ipairs(Roles.config.order) do
local role = Roles.config.roles[role_name]
local color = role.custom_color or Colours.white --[[@as Color.struct]]
local color = (role.custom_color or Colours.white) --[[@as Color.struct]]
local color_str = string.format("[color=%d, %d, %d]", color.r, color.g, color.b)
output = output .. string.format("\n%s %s) %s[/color]", color_str, index, serpent.line(role))
end
+4 -4
View File
@@ -399,7 +399,7 @@ end
--- @param self ExpRoles.Role
--- @param action string
--- @return boolean
function Role:is_allowed(action)
function Role.is_allowed(self, action)
local allowed = self.allowed_actions
return allowed["core.admin"] or allowed[permission_from_action(action)] or false
end
@@ -408,7 +408,7 @@ end
--- @param self ExpRoles.Role
--- @param name string
--- @return boolean
function Role:has_flag(name)
function Role.has_flag(self, name)
return self.allowed_actions[permission_from_flag(name)] or false
end
@@ -416,7 +416,7 @@ end
--- @param self ExpRoles.Role
--- @param online boolean? When given, filter by connected state
--- @return LuaPlayer[]
function Role:get_players(online)
function Role.get_players(self, online)
local players = {}
for player_name, role_names in pairs(ExpRoles.config.players) do
for _, role_name in pairs(role_names) do
@@ -437,7 +437,7 @@ end
--- @param self ExpRoles.Role
--- @param message LocalisedString
--- @return number # Number of players the message was sent to
function Role:print(message)
function Role.print(self, message)
local players = self:get_players(true)
for _, player in pairs(players) do
player.print(message)