Artisz Posted July 5, 2017 Share Posted July 5, 2017 Hi! How can I do it that if I have a sentence with a smile(:D) in the middle of it, then don't write the smile, but another word(*laugh). Link to comment
Artisz Posted July 5, 2017 Author Share Posted July 5, 2017 (edited) 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 July 5, 2017 by Artisz Link to comment
Administrators Lpsd Posted July 5, 2017 Administrators Share Posted July 5, 2017 (edited) 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 July 5, 2017 by LopSided_ 1 Link to comment
Artisz Posted July 5, 2017 Author Share Posted July 5, 2017 (edited) OK, now it's working. Thank you! Edited July 5, 2017 by Artisz 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