allow numbers in gsub pattern, as lua does

closes #1999

(cherry picked from commit f73dd9eaca421af783a8c97cc36d0a73977bde8a)
This commit is contained in:
payonel 2020-06-07 16:46:15 -07:00 committed by DreamMasterXXL
parent 650639530a
commit 3141b56472

View File

@ -621,7 +621,7 @@ do
local function str_gsub(s, pattern, repl, n)
checkArg(1, s, "string")
checkArg(2, pattern, "string")
checkArg(2, pattern, "string", "number")
checkArg(3, repl, "number", "string", "function", "table")
checkArg(4, n, "number", "nil")
@ -629,6 +629,7 @@ do
return string_gsub(s, pattern, repl, n)
end
pattern = tostring(pattern)
local src = strptr(s);
local p = strptr(pattern)
local tr = type(repl)