Guest User

Untitled

a guest
Mar 21st, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. --Secret Code Parser - change strings into secret codes defined!
  2. --Created by Brandon Blanker Lim-it @flamendless
  3.  
  4. local str_sample = arg[1] or "Hi, my name is Brandon"
  5. --this is the JEJEMON trend code
  6. local secret_code = {
  7. a = {"4","ha","ah"},
  8. i = "1",
  9. e = "3",
  10. o = "0",
  11. s = {"x","sx","xh"}
  12. }
  13.  
  14. local function string_to_table(str)
  15. assert(str, "string is required")
  16. local t = {}
  17. str:gsub(".", function(char) table.insert(t,char) end)
  18. return t
  19. end
  20.  
  21. local function secretify(str)
  22. local str = str
  23. local t = string_to_table(str)
  24. for k,v in pairs(t) do
  25. if secret_code[v] then
  26. if type(secret_code[v]) == "table" then
  27. local r = math.random(1, #secret_code[v])
  28. t[k] = secret_code[v][r]
  29. else
  30. t[k] = secret_code[v]
  31. end
  32. else
  33. t[k] = v
  34. end
  35. end
  36. return table.concat(t)
  37. end
  38.  
  39. print(secretify(str_sample))
Add Comment
Please, Sign In to add comment