Sign in to follow this  

[HELP] Case sensitive table

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
    for _, msg in pairs(values) do
        if message == msg then
            outputChatBox("Console: Hey!", source, 255, 100, 100)

I heard string.gsub can do this but I'm not sure how to use that. Any help regarding this would be appreciated.

Share this post

Link to post

I don't know how you can use string.gsub but you could just do your table all in lower case


local values = {"Hi", "Hello", "Hey"}


local values = {"hi", "hello", "hey"}

And use 

string.lower( string )

In order to set the player's input in lower case

Share this post

Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.