match_pattern checks if text exists
This commit is contained in:
parent
4e4dc7ed11
commit
ca97baa60d
@ -441,9 +441,11 @@ end
|
|||||||
|
|
||||||
-- Returns a table with matches or nil
|
-- Returns a table with matches or nil
|
||||||
function match_pattern(pattern, text)
|
function match_pattern(pattern, text)
|
||||||
local matches = { string.match(text, pattern) }
|
if text then
|
||||||
if next(matches) then
|
local matches = { string.match(text, pattern) }
|
||||||
return matches
|
if next(matches) then
|
||||||
|
return matches
|
||||||
|
end
|
||||||
end
|
end
|
||||||
-- nil
|
-- nil
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user