Skip to content

Instantly share code, notes, and snippets.

@flamendless
Created March 13, 2018 00:52
Show Gist options
  • Save flamendless/1759e153fae8277f0a9665bbffe6daee to your computer and use it in GitHub Desktop.
Save flamendless/1759e153fae8277f0a9665bbffe6daee to your computer and use it in GitHub Desktop.
Convert string into secret code!
--Secret Code Parser - change strings into secret codes defined!
--Created by Brandon Blanker Lim-it @flamendless
local str_sample = arg[1] or "Hi, my name is Brandon"
--this is the JEJEMON trend code
local secret_code = {
a = {"4","ha","ah"},
i = "1",
e = "3",
o = "0",
s = {"x","sx","xh"}
}
local function string_to_table(str)
assert(str, "string is required")
local t = {}
str:gsub(".", function(char) table.insert(t,char) end)
return t
end
local function secretify(str)
local str = str
local t = string_to_table(str)
for k,v in pairs(t) do
if secret_code[v] then
if type(secret_code[v]) == "table" then
local r = math.random(1, #secret_code[v])
t[k] = secret_code[v][r]
else
t[k] = secret_code[v]
end
else
t[k] = v
end
end
return table.concat(t)
end
print(secretify(str_sample))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment