Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- s="MY super SECRET messAGE"
- shift = -10 --choose any number between [-32,128]for shift.
- length = string.len(s) --gets string length (#of characters)
- for i=1, length, 1 do --Runs the code between do and end
- c=string.sub(s,i,i) --length #of times. length = #of char
- --string.sub() gets a substring
- --from index i, to index i.
- s=string.sub(s,1,i-1)..string.char(string.byte(c)+shift))..string.sub(s,i+1,string.len(s))
- --string.gsub() substitutes any
- --character in s matching c with
- --string.char(…)
- print(s) --prints the new string s
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement