more type hints and resolved diagnostic disables with 'as'
This commit is contained in:
parent
ec2921e393
commit
2047794173
@ -138,7 +138,7 @@ function util.strminw(str, width) return cc_strings.ensure_width(str, width) end
|
|||||||
|
|
||||||
-- concatenation with built-in to string
|
-- concatenation with built-in to string
|
||||||
---@nodiscard
|
---@nodiscard
|
||||||
---@vararg any
|
---@param ... any
|
||||||
---@return string
|
---@return string
|
||||||
function util.concat(...)
|
function util.concat(...)
|
||||||
local args, strings = t_pack(...), {}
|
local args, strings = t_pack(...), {}
|
||||||
@ -152,7 +152,7 @@ util.c = util.concat
|
|||||||
-- sprintf implementation
|
-- sprintf implementation
|
||||||
---@nodiscard
|
---@nodiscard
|
||||||
---@param format string
|
---@param format string
|
||||||
---@vararg any
|
---@param ... any
|
||||||
function util.sprintf(format, ...) return string.format(format, ...) end
|
function util.sprintf(format, ...) return string.format(format, ...) end
|
||||||
|
|
||||||
-- format a number string with commas as the thousands separator<br>
|
-- format a number string with commas as the thousands separator<br>
|
||||||
|
|||||||
@ -295,8 +295,12 @@ local function config_view(display)
|
|||||||
for i = 1, tmp_cfg.UnitCount do
|
for i = 1, tmp_cfg.UnitCount do
|
||||||
local conf = tool_ctl.cooling_elems[i]
|
local conf = tool_ctl.cooling_elems[i]
|
||||||
-- already verified fields are numbers
|
-- already verified fields are numbers
|
||||||
---@diagnostic disable-next-line: assign-type-mismatch
|
tmp_cfg.CoolingConfig[i] = {
|
||||||
tmp_cfg.CoolingConfig[i] = { TurbineCount = tonumber(conf.turbines.get_value()), BoilerCount = tonumber(conf.boilers.get_value()), TankConnection = conf.tank.get_value() }
|
TurbineCount = tonumber(conf.turbines.get_value()) --[[@as number]],
|
||||||
|
BoilerCount = tonumber(conf.boilers.get_value()) --[[@as number]],
|
||||||
|
TankConnection = conf.tank.get_value()
|
||||||
|
}
|
||||||
|
|
||||||
if conf.tank.get_value() then any_has_tank = true end
|
if conf.tank.get_value() then any_has_tank = true end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -41,9 +41,7 @@ function rsctl.new(redstone_rtus)
|
|||||||
function public.digital_read(port)
|
function public.digital_read(port)
|
||||||
for i = 1, #redstone_rtus do
|
for i = 1, #redstone_rtus do
|
||||||
local io = redstone_rtus[i].get_db().io[port]
|
local io = redstone_rtus[i].get_db().io[port]
|
||||||
-- this would only be digital, so it would only return boolean or nil
|
if io ~= nil then return io.read() --[[@as boolean|nil]] end
|
||||||
---@diagnostic disable-next-line: return-type-mismatch
|
|
||||||
if io ~= nil then return io.read() end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user