comparing and returning bool from string in name

I am trying to find a way to utilize “string.match” to see wheter a players nick has a specific number or text in it,
and I am trying to return a bool wheter it does or not. How can I efficiently do this?

what I am trying to do is to check in an if-statement, wheter the player has this number/text in this name

I usually use

string.find, it’s easier and on it’s own can be checked using an if statement



if string.find( playername, text ) then
    -- something
end


[editline]4th November 2017[/editline]

If you want a bool:



local function PlayerNameContains( name, text )
    return string.find( name, text ) ~= nil
end