Created
March 13, 2018 00:52
-
-
Save flamendless/1759e153fae8277f0a9665bbffe6daee to your computer and use it in GitHub Desktop.
Convert string into secret code!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--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
Dive into the immersive sounds of Bunkr Album, where each track takes you on a unique auditory journey through emotion and storytelling.