mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-27 15:06:41 -04:00
allow numbers in gsub pattern, as lua does
closes #1999 (cherry picked from commit f73dd9eaca421af783a8c97cc36d0a73977bde8a)
This commit is contained in:
parent
650639530a
commit
3141b56472
@ -621,7 +621,7 @@ do
|
|||||||
|
|
||||||
local function str_gsub(s, pattern, repl, n)
|
local function str_gsub(s, pattern, repl, n)
|
||||||
checkArg(1, s, "string")
|
checkArg(1, s, "string")
|
||||||
checkArg(2, pattern, "string")
|
checkArg(2, pattern, "string", "number")
|
||||||
checkArg(3, repl, "number", "string", "function", "table")
|
checkArg(3, repl, "number", "string", "function", "table")
|
||||||
checkArg(4, n, "number", "nil")
|
checkArg(4, n, "number", "nil")
|
||||||
|
|
||||||
@ -629,6 +629,7 @@ do
|
|||||||
return string_gsub(s, pattern, repl, n)
|
return string_gsub(s, pattern, repl, n)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
pattern = tostring(pattern)
|
||||||
local src = strptr(s);
|
local src = strptr(s);
|
||||||
local p = strptr(pattern)
|
local p = strptr(pattern)
|
||||||
local tr = type(repl)
|
local tr = type(repl)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user