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