Skip to content

Commit

Permalink
add :GetSettings() method
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuh4 committed Jun 22, 2024
1 parent 392fff4 commit 229c500
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Noir/Built-Ins/Services/GameSettingsService.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ Noir.Services.GameSettingsService = Noir.Services:CreateService("GameSettingsSer
function Noir.Services.GameSettingsService:ServiceInit() end
function Noir.Services.GameSettingsService:ServiceStart() end

--[[
Returns a list of all game settings.
]]
---@return table<integer, SWGameSettingEnum>
function Noir.Services.GameSettingsService:GetSettings()
return server.getGameSettings()
end

--[[
Returns the value of the provided game setting.
Expand All @@ -51,11 +59,10 @@ function Noir.Services.GameSettingsService:ServiceStart() end
---@param name SWGameSettingEnum
---@return any
function Noir.Services.GameSettingsService:GetSetting(name)
local settings = server.getGameSettings()
local settings = self:GetSettings()
local setting = settings[name]

if not setting then
Noir.Libraries.Logging:Error("GameSettingsService", "GetSetting(): %s is not a valid game setting.", false, name)
return
end

Expand Down

0 comments on commit 229c500

Please sign in to comment.