mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-08-13 00:45:11 +09:00
Type the last of the forward declarations
Locals declared ahead of an assignment inside a callback were inferred as nil at every use site. The role event handlers are given a class so the table is not unified with the other module handler tables. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -137,7 +137,9 @@ local function on_player_ammo_inventory_changed(event)
|
||||
if not player or not player.character then return end
|
||||
|
||||
local character_ammo = assert(player.get_inventory(defines.inventory.character_ammo))
|
||||
local item = character_ammo[player.character.selected_gun_index]
|
||||
local gun_index = player.character.selected_gun_index
|
||||
--- @cast gun_index uint
|
||||
local item = character_ammo[gun_index]
|
||||
if not item or not item.valid or not item.valid_for_read then
|
||||
return
|
||||
end
|
||||
|
||||
@@ -102,7 +102,7 @@ Elements.reason_confirm = Gui.define("player_list/reason_confirm")
|
||||
local action_name = Elements.container.get_selected_action(player)
|
||||
local button_data = action_name and config.buttons[action_name]
|
||||
if button_data and button_data.reason_callback then
|
||||
local reason = element.parent.entry.text
|
||||
local reason = assert(assert(element.parent).entry).text --[[@as string?]]
|
||||
if reason == nil or not reason:find("%S") then reason = "no reason given" end
|
||||
button_data.reason_callback(player, reason)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user