Jump to content

[HELP] Case sensitive table


Bilal135

Recommended Posts

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...