string.find and string.match not working !

So I have exactly the same problem with these methods like I have on Starfall preprocessor.

Basicaly I want to know if a string is found in another string. This is for a search box system.

I have a table listing all bans. I’d like when you type letter per letter the name of the player, it removes all lines which the serached name isn’t contained in.

I can give you this code :



//BanManagerList is the list of all bans
//txt is the text in the search box
for k, v in pairs(GameGlobal.BanManagerList) do
        if (string.find(string.upper(txt), string.upper(v.name))) then //The problem is here : only works when strings are identical...
                GameGlobal.BanManagerTempList:AddLine(v.id, v.name, v.hours, v.reason, v.note)
        end
end


You may wanna check for Capitalization

What is the point of your message ? I don’t correctly understand what you mean.

If you mean me to give up, then there’s no point to answer that, because the topic will never get solved with these answers.

So if you only have that pointless ideas in head, please get out of this topic. Or show yourself adult and make this topic to advance by solving the issue.

Read the documentation on

string.find and look at what your instance of

string.find does. It should be pretty obvious once you read up on it.

Also, I will ask that when someone gives you help, that you treat that person respectfully and not attack them because they never gave you a direct answer. Niandra told you to check for letter casing in your strings because the string functions are case-sensitive. You already took care of that with string.upper though.

Oh shit, rofl

If the guy is already checking for that then I apologize, I did read over the code before posting but that somehow escaped me

Ok I solved the problem, I didn’t make attention to the argument order for this function, due to the fact most of GMod functions take arguments at inverse for me…