Jump to content

Laugh from :D


Artisz

Recommended Posts

Thank you, but what if I have two tables, one with the emoticons, the other with their meanings. How can I do that if there is an emoticon in the text, what is in the table to, then change it to the meaning?

emoticons = {
    ":D",
	":("
}

meanings = {
	"laugh",
    "sad"
}

 

Edited by Artisz
Link to comment
  • Administrators
emoticons = {
    {":D", "laugh"},
	{":(", "sad"}
}

function checkMessage(message)
  for i=1,#emoticons do
    if string.find(message, emoticons[i][1]) then
      message:gsub(emoticons[i][1], emoticons[i][2])
    end
  end
end
  
checkMessage("Testing message :D")

something like this?

Edited by LopSided_
  • Like 1
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...