Skip to content

Commit

Permalink
Add utility to check for build number
Browse files Browse the repository at this point in the history
  • Loading branch information
p3lim committed Nov 1, 2024
1 parent dc70793 commit 3639e98
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion modules/misc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ local _, namespace = ...
--]]

-- game version API
local _, _, _, interfaceVersion = GetBuildInfo()
local _, buildVersion, _, interfaceVersion = GetBuildInfo()
--[[ namespace:IsRetail()
Checks if the current client is running the "retail" version.
--]]
Expand All @@ -31,6 +31,18 @@ function addon:IsClassic()
return not addon:IsRetail() and not addon:IsClassicEra()
end

--[[ namespace:HasBuild(_buildNumber_[, _interfaceVersion_])
Checks if the current client is running a build equal to or newer than the specified.
Optionally also check against the interface version.
--]]
function addon:HasBuild(build, interface)
if interface and interfaceVersion < interface then
return
end

return tonumber(buildVersion) >= build
end

--[[ namespace:ArgCheck(arg, argIndex, type[, type...])
Checks if the argument `arg` at position `argIndex` is of type(s).
--]]
Expand Down

0 comments on commit 3639e98

Please sign in to comment.