Fix type annotations the linter found to be wrong

Async ids come from `get_function_name`, which returns a string, but
were documented as numbers.

`setmetatable` in clusterio's compat module loses `LibCompat` on the
module return, so the require is cast.

`GuiData.__index` accepts a `DataKey` but emmylua needs that as an
index signature on the class.

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 c233a9ab06
commit 0bb92966eb
4 changed files with 7 additions and 6 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ Adds permission group syncing to clusterio
]] ]]
local clusterio_api = require("modules/clusterio/api") local clusterio_api = require("modules/clusterio/api")
local compat = require("modules/clusterio/compat") local compat = require("modules/clusterio/compat") --[[@as LibCompat]]
--- Top level module table, contains event handlers and public methods --- Top level module table, contains event handlers and public methods
--- @class ExpGroups --- @class ExpGroups
+2 -1
View File
@@ -61,7 +61,8 @@ local GuiData = {
--- @field element_data table<uint, table<uint, any>> --- @field element_data table<uint, table<uint, any>>
--- @field player_data table<uint, any> --- @field player_data table<uint, any>
--- @field force_data table<uint, any> --- @field force_data table<uint, any>
--- @field global_data table --- @field global_data table
--- @field [DataKey] any
-- This class has no prototype methods -- This class has no prototype methods
-- Same as raw but __index ensures the values exist -- Same as raw but __index ensures the values exist
+1 -1
View File
@@ -12,7 +12,7 @@ made with `assign_player_local`.
]] ]]
local clusterio_api = require("modules/clusterio/api") local clusterio_api = require("modules/clusterio/api")
local compat = require("modules/clusterio/compat") local compat = require("modules/clusterio/compat") --[[@as LibCompat]]
local Async = require("modules/exp_util/async") local Async = require("modules/exp_util/async")
--- @class ExpRoles --- @class ExpRoles
+3 -3
View File
@@ -93,7 +93,7 @@ local Async = {
Async.status = {} Async.status = {}
--- @class Async.AsyncFunction --- @class Async.AsyncFunction
--- @field id number The id of this async function --- @field id string The id of this async function
--- @operator call: Async.AsyncReturn<any> --- @operator call: Async.AsyncReturn<any>
Async._function_prototype = {} Async._function_prototype = {}
@@ -104,10 +104,10 @@ Async._function_metatable = {
} }
--- @class Async.AsyncReturn<F> --- @class Async.AsyncReturn<F>
--- @field func_id number The id of the async function to be called --- @field func_id string The id of the async function to be called
--- @field args any[] The arguments to call the function with --- @field args any[] The arguments to call the function with
--- @field tick number? If present, the function will be called on this game tick --- @field tick number? If present, the function will be called on this game tick
--- @field next_id number? The id of the async function to be called with the return value --- @field next_id string? The id of the async function to be called with the return value
--- @field canceled boolean? True if the call has been canceled --- @field canceled boolean? True if the call has been canceled
--- @field completed boolean? True if the call has completed --- @field completed boolean? True if the call has completed
--- @field return_values any? The return values of the function call --- @field return_values any? The return values of the function call