Spoiler
So for example, "Hi" would be kL
If you can, how?
Posted 24 April 2013 - 01:16 AM
Posted 24 April 2013 - 01:38 AM
Edited by theoriginalbit, 24 April 2013 - 01:40 AM.
Posted 24 April 2013 - 03:04 AM
Posted 24 April 2013 - 03:10 AM
Mackan90096, on 24 April 2013 - 03:04 AM, said:
function decrypt(str) local temp = "" for i = 1, str:len() do local char = str:sub(i,i) for i, v in pairs(lookup) do if v == char then temp = temp .. char break end end end return str end
Posted 24 April 2013 - 07:22 AM
Dlcruz129, on 24 April 2013 - 03:12 AM, said:
function decode(str) -- create our return string local temp = "" -- loop through the input string for i = 1, #str do -- make a variable to track if a match was found (this is for non-alphabetic character support) local found = false -- get the current character local char = str:sub(i,i) -- loop through all the table entries for k, v in pairs(lookup) do -- if the entry in the table is the same as the current character if v == char then -- append it to the return value temp = temp..k -- set the found flag to true found = true -- stop searching the lookup table break end end -- if we didn't find a match, it's not an alphabetic character, so append it if not found then temp = temp..char end end -- return the decoded string return temp end
0 members, 1 guests, 0 anonymous users