diff options
author | C3pa <41503714+C3pa@users.noreply.github.com> | 2023-03-18 19:30:00 +0100 |
---|---|---|
committer | C3pa <41503714+C3pa@users.noreply.github.com> | 2023-03-18 19:30:00 +0100 |
commit | bb18eef81fab79c28347f7a9c35fc00865be4b45 (patch) | |
tree | 87cf2a84d729b0d165c2928549804da5819cd98b /meta/template | |
parent | 6ef1608d857e0179c4db7a14037df84dbef676c8 (diff) | |
download | lua-language-server-bb18eef81fab79c28347f7a9c35fc00865be4b45.zip |
Make functions in string api accept numbers
All of these functions effectively call `tostring()`, when the passed parameter is a number. I think there is no need to raise warnings if users pass numbers instead of strings to these functions.
Diffstat (limited to 'meta/template')
-rw-r--r-- | meta/template/string.lua | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/meta/template/string.lua b/meta/template/string.lua index cf83104b..08767fbb 100644 --- a/meta/template/string.lua +++ b/meta/template/string.lua @@ -5,7 +5,7 @@ string = {} ---#DES 'string.byte' ----@param s string +---@param s string|number ---@param i? integer ---@param j? integer ---@return integer ... @@ -27,7 +27,7 @@ function string.char(byte, ...) end function string.dump(f, strip) end ---#DES 'string.find' ----@param s string +---@param s string|number ---@param pattern string ---@param init? integer ---@param plain? boolean @@ -60,7 +60,7 @@ function string.gmatch(s, pattern, init) end ---#end ---#DES 'string.gsub' ----@param s string +---@param s string|number ---@param pattern string ---@param repl string|number|table|function ---@param n? integer @@ -70,19 +70,19 @@ function string.gmatch(s, pattern, init) end function string.gsub(s, pattern, repl, n) end ---#DES 'string.len' ----@param s string +---@param s string|number ---@return integer ---@nodiscard function string.len(s) end ---#DES 'string.lower' ----@param s string +---@param s string|number ---@return string ---@nodiscard function string.lower(s) end ---#DES 'string.match' ----@param s string +---@param s string|number ---@param pattern string ---@param init? integer ---@return any ... @@ -107,14 +107,14 @@ function string.packsize(fmt) end ---#if VERSION <= 5.1 and not JIT then ---#DES 'string.rep<5.1' ----@param s string +---@param s string|number ---@param n integer ---@return string ---@nodiscard function string.rep(s, n) end ---#else ---#DES 'string.rep>5.2' ----@param s string +---@param s string|number ---@param n integer ---@param sep? string ---@return string @@ -123,13 +123,13 @@ function string.rep(s, n, sep) end ---#end ---#DES 'string.reverse' ----@param s string +---@param s string|number ---@return string ---@nodiscard function string.reverse(s) end ---#DES 'string.sub' ----@param s string +---@param s string|number ---@param i integer ---@param j? integer ---@return string @@ -147,7 +147,7 @@ function string.sub(s, i, j) end function string.unpack(fmt, s, pos) end ---#DES 'string.upper' ----@param s string +---@param s string|number ---@return string ---@nodiscard function string.upper(s) end |