-
Since version 3.0, the behavior of automatic substitution of function parameters has changed. ---Sets WiFi physical mode.
---@param mode integer @b | g | n
---|'wifi.PHYMODE_B' #802.11b, more range, low Transfer rate, more current draw
---|'wifi.PHYMODE_G' #802.11g, medium range, medium transfer rate, medium current draw
---|'wifi.PHYMODE_N' #802.11n, least range, fast transfer rate, least current draw (STATION ONLY)
---@return integer @physical mode after setup
function wifi.setphymode(mode) end in version 2.6, the parameter without quotes was automatically suggested when entering, that is, the result was the line (as needed) Starting from version 3.0, the parameter is suggested as string When using an alias, the parameter is suggested as string as well ---@alias als 'a1'|'a2'
---@param y als
function foo(y) end
foo('a1') -- foo(a1) <-- version 2.6.8 I have read the "Breaking changes in 3.x", in particular the section "doc-enum must be a string", and I am not sure if changing the behavior when replacing a parameter is a bug. However, I have not found a way to annotate the function to get a parameter replacement not as a string. Could someone tell me how in version >= 3.0 to provide substitute of parameters not in the form of a string type. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Use ---@param mode integer @b | g | n
---|`wifi.PHYMODE_B` #802.11b, more range, low Transfer rate, more current draw
---|`wifi.PHYMODE_G` #802.11g, medium range, medium transfer rate, medium current draw
---|`wifi.PHYMODE_N` #802.11n, least range, fast transfer rate, least current draw (STATION ONLY) |
Beta Was this translation helpful? Give feedback.
-
Thanks for your reply. Everything works correctly with back quotes. ---@alias alx
---|`A1` #comment 1
---|`A2` #comment 2
---@param x alx
function foo(x) end
foo(A1) ---@alias als `a1`|`a2`
---@param y als
function foo(y) end
foo(a1) ---@param x integer|`t.A1`|`t.A2`
function baz(x) end
baz(t.A1) ---@param save boolean
---|`true` # comment 1
---|`false` # comment 2
function bar(save) end
bar(false) |
Beta Was this translation helpful? Give feedback.
Use