Assert row lookups and the position shorthand

spawn_area accepts both position forms on purpose, so it asserts that
one of the two is present rather than narrowing the type.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
bbassie
2026-08-07 15:31:43 +00:00
co-authored by Claude Opus 5
parent b75e283fc0
commit 7d8de94c2f
3 changed files with 9 additions and 9 deletions
+3 -3
View File
@@ -184,7 +184,7 @@ end
--- @param item_selector LuaGuiElement
function Elements.production_table.remove_row(production_table, item_selector)
local rows = Elements.production_table.data[production_table].rows
local row = rows[item_selector.index]
local row = assert(rows[item_selector.index])
rows[item_selector.index] = nil
Gui.destroy_if_valid(item_selector)
for _, element in pairs(row) do
@@ -197,7 +197,7 @@ end
--- @param item_selector LuaGuiElement
function Elements.production_table.reset_row(production_table, item_selector)
local rows = Elements.production_table.data[production_table].rows
local row = rows[item_selector.index]
local row = assert(rows[item_selector.index])
row.production.caption = "0.00"
row.consumption.caption = "0.00"
row.net.caption = "0.00"
@@ -210,7 +210,7 @@ end
--- @param row_data ExpGui_ProductionStats.elements.production_table.row_data
function Elements.production_table.refresh_row(production_table, item_selector, row_data)
local rows = Elements.production_table.data[production_table].rows
local row = rows[item_selector.index]
local row = assert(rows[item_selector.index])
row.production.caption = row_data.production
row.consumption.caption = row_data.consumption
row.net.caption = row_data.net