Remove asserts the types already cover

The nil check burn down added guards which turned out redundant once
the surrounding annotations landed. `_has_handlers` is set to true when
the first handler registers, so it is a boolean rather than the literal
false it was inferred as.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
bbassie
2026-08-07 15:31:48 +00:00
co-authored by Claude Opus 5
parent f907007d14
commit 619ed4b39f
19 changed files with 68 additions and 55 deletions
+6 -3
View File
@@ -116,7 +116,8 @@ end
--- @param player LuaPlayer
--- @return LuaGuiElement
function Gui.get_top_element(define, player)
return (assert(assert(player_elements[player.index]).top[define.name], "Element is not on the top flow"))
local value = assert(assert(player_elements[player.index]).top[define.name], "Element is not on the top flow")
return value
end
--- Register a element define to be drawn to the left flow on join
@@ -124,7 +125,8 @@ end
--- @param player LuaPlayer
--- @return LuaGuiElement
function Gui.get_left_element(define, player)
return (assert(assert(player_elements[player.index]).left[define.name], "Element is not on the left flow"))
local value = assert(assert(player_elements[player.index]).left[define.name], "Element is not on the left flow")
return value
end
--- Register a element define to be drawn to the relative flow on join
@@ -132,7 +134,8 @@ end
--- @param player LuaPlayer
--- @return LuaGuiElement
function Gui.get_relative_element(define, player)
return (assert(assert(player_elements[player.index]).relative[define.name], "Element is not on the relative flow"))
local value = assert(assert(player_elements[player.index]).relative[define.name], "Element is not on the relative flow")
return value
end
--- Ensure all the correct elements are visible and exist