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:
bbassie
2026-08-07 15:31:18 +00:00
co-authored by Claude Opus 5
parent 5aeafa0e11
commit f39da0c585
7 changed files with 16 additions and 7 deletions
+6 -1
View File
@@ -9,7 +9,10 @@ had, and event_handler expects `events` to be the handlers to register.
local clusterio_api = require("modules/clusterio/api")
local ExpRoles = require("modules/exp_roles/control")
return {
--- @class ExpRoles.EventHandlers
--- @field on_load fun()
--- @field events table<defines.events, fun(event: EventData)>
local handlers = {
on_load = ExpRoles.on_load,
events = {
[clusterio_api.events.on_server_startup] = ExpRoles.on_server_startup,
@@ -17,3 +20,5 @@ return {
[defines.events.on_player_joined_game] = ExpRoles.on_player_joined_game,
},
}
return handlers