Bilal135 Posted December 6, 2018 Share Posted December 6, 2018 So, if I derive values from a certain table and use those values to do something, they will always be case sensitive. How can I remove that? I don't want the values of the table to be case sensitive, For example, local values = {"Hi", "Hello", "Hey"} And if I detect if a player said one of these in chat by looping through them, it will work but only if the player typed the first letter capital. addEventHandler("onPlayerChat", root, function(message, messageType) if not messageType == 0 then return end for _, msg in pairs(values) do if message == msg then outputChatBox("Console: Hey!", source, 255, 100, 100) else return end end end) I heard string.gsub can do this but I'm not sure how to use that. Any help regarding this would be appreciated. Link to comment
Gordon_G Posted December 6, 2018 Share Posted December 6, 2018 I don't know how you can use string.gsub but you could just do your table all in lower case From local values = {"Hi", "Hello", "Hey"} To local values = {"hi", "hello", "hey"} And use string.lower( string ) In order to set the player's input in lower case Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now