ws-apifix: type fixes (no new diagnostics)
This commit is contained in:
1 parent
2f0ff81c95
commit
3c2a646365
2 files changed
+6
-3
No files matched your search
@@ -134,7 +134,7 @@ local function patternAt(m: any, pattern: any, row: any, channel: any): (any, Er
|
||||
if not isModule(m) then
|
||||
return bad("needs a tracker Module")
|
||||
end
|
||||
local p = if int(pattern, 0, 1e6) then m.patterns[pattern + 1] else nil
|
||||
local p: any = if int(pattern, 0, 1e6) then m.patterns[pattern + 1] else nil
|
||||
if p == nil then
|
||||
return bad("no pattern " .. tostring(pattern))
|
||||
end
|
||||
@@ -334,7 +334,10 @@ function MusicOps.addInstrument(m: any, spec: InstrumentSpec): (number?, Err.Err
|
||||
local env = Tracker.newEnvelope()
|
||||
local last = -1
|
||||
for i, pt in e.points do
|
||||
local tick, value = type(pt) == "table" and pt[1], type(pt) == "table" and pt[2]
|
||||
local tick: any, value: any = nil, nil
|
||||
if type(pt) == "table" then
|
||||
tick, value = pt[1], pt[2]
|
||||
end
|
||||
if not int(tick, 0, 65535) or type(value) ~= "number" or value < 0 or value > 64 or (tick :: number) <= last then
|
||||
return bad("addInstrument: envelope point " .. i .. " must be { tick, 0..64 } with increasing ticks")
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user