Clear the last of the nil checks

Guards now cover the statements that follow them, and a couple of reads
are restructured so the narrowing survives.

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 76ecc37d3f
commit f5656025ee
9 changed files with 31 additions and 22 deletions
+2 -2
View File
@@ -551,7 +551,7 @@ function ExpUtil.move_items_to_surface(options)
options.item = item
entity = ExpUtil.get_storage_for_stack(options)
entity.insert(options.item)
local item_stack = options.item --[[@as LuaItemStack]]
local item_stack = options.item --[[@as LuaItemStack]]
item_stack.clear()
end
end
@@ -604,7 +604,7 @@ end
--- @param n number
--- @return string
function ExpUtil.comma_value(n) -- credit http://richard.warburton.it
local left, num, right = string.match(n, "^([^%d]*%d)(%d*)(.-)$")
local left, num, right = string.match(n, "^([^%d]*%d)(%d*)(.-)$")
assert(left and num and right)
return left .. (num:reverse():gsub("(%d%d%d)", "%1, "):reverse()) .. right
end