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)
|
||||||
|
if text then
|
||||||
local matches = { string.match(text, pattern) }
|
local matches = { string.match(text, pattern) }
|
||||||
if next(matches) then
|
if next(matches) then
|
||||||
return matches
|
return matches
|
||||||
end
|
end
|
||||||
|
end
|
||||||
-- nil
|
-- nil
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user