Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- HOW THE LANGUAGE WORKS :
- This is inspired by a stupid little 'secret language' my 2nd grade teacher taught me.
- Basically, take a word and iterate through the letters. If the letter is a vowel,
- then leave it be. If the letter is not a vowel, add "op" to the end of it.
- For example, "Hi" would result in "HOPi", and "face" would result in "fopacope"
- TODO: add an ignore list with characters such as ".", "?", "!", etc.
- ]]
- local vowels = {
- a = true, e = true, i = true, o = true, u = true
- }
- local translate = {
- toEnglish = function(words)
- local product = {}
- for letter = 1, words:len() do
- local let = words:sub(letter, letter)
- if words:sub(letter + 1, letter + 2):lower() == "op" then
- table.insert(product, let)
- elseif vowels[let:lower()] and words:sub(letter + 1, letter + 1):lower() ~= "p" then
- table.insert(product, let)
- end
- end
- return table.concat(product)
- end,
- toLanguage = function(words)
- local product = {}
- for letter = 1, words:len() do
- local let = words:sub(letter, letter)
- table.insert(product, let == " " and " " or vowels[let:lower()] and let or let == let:lower() and let .. "op" or let .. "OP")
- end
- return table.concat(product)
- end
- }
- local to = translate.toLanguage("My name is David")
- print(to) --OUTPUT: MOPyop nopamope isop DOPavopidop
Advertisement
Add Comment
Please, Sign In to add comment