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 more characters to ignore list
- ]]
- local vowels = {
- a = true, e = true, i = true, o = true, u = true
- }
- local ignoreList = {
- ["."] = true, ["!"] = true, ["?"] = true, ["/"] = 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" or
- vowels[let:lower()] and words:sub(letter + 1, letter + 1):lower() ~= "p" or
- ignoreList[let]
- ) 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
- ignoreList[let] and let 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.toEnglish("hop.")
- print(to) --OUTPUT: MOPyop nopamope isop DOPavopidop
Advertisement
Add Comment
Please, Sign In to add comment