diff --git a/changelog/snippets/other.7052.md b/changelog/snippets/other.7052.md new file mode 100644 index 00000000000..4b445b1c4e9 --- /dev/null +++ b/changelog/snippets/other.7052.md @@ -0,0 +1 @@ +- (#7052) Clean up code style and add annotations in `SelectedInfo.lua`. diff --git a/engine/User/UserUnit.lua b/engine/User/UserUnit.lua index dc87cc93ed0..472e248bf1c 100644 --- a/engine/User/UserUnit.lua +++ b/engine/User/UserUnit.lua @@ -138,8 +138,9 @@ function UserUnit:GetCreator() end --- Returns the current custom name, `nil` if none +---@param filler any ---@return string | nil -function UserUnit:GetCustomName() +function UserUnit:GetCustomName(filler) end --- Returns a table of economy data diff --git a/lua/keymap/selectedinfo.lua b/lua/keymap/selectedinfo.lua index 60bf802304f..fa7dde3516d 100644 --- a/lua/keymap/selectedinfo.lua +++ b/lua/keymap/selectedinfo.lua @@ -14,18 +14,10 @@ ---@field userUnit? UserUnit ---@field workProgress number - -local Prefs = import("/lua/user/prefs.lua") -local options = Prefs.GetFromCurrentProfile('options') - -local selectionOverlay = { - key = 'selection', - Label = "Selection", - Pref = 'range_RenderSelected', - Type = 3, - Tooltip = "overlay_selection", -} - +--- Gets rollover information for the given unit. +--- This replicates `GetRolloverInfo` but for any unit. +---@param unit UserUnit +---@return RolloverInfo function GetUnitRolloverInfo(unit, skipFocus) local info = {} @@ -83,3 +75,16 @@ function GetUnitRolloverInfo(unit, skipFocus) return info end + +--#region Backwards compatibility +local Prefs = import("/lua/user/prefs.lua") +local options = Prefs.GetFromCurrentProfile('options') + +local selectionOverlay = { + key = 'selection', + Label = "Selection", + Pref = 'range_RenderSelected', + Type = 3, + Tooltip = "overlay_selection", +} +--#endregion