SHOW:
|
|
- or go back to the newest paste.
1 | - | s=’MY super SECRET messAGE’ |
1 | + | s="MY super SECRET messAGE" |
2 | shift = -10 --choose any number between [-32,128]for shift. | |
3 | length = string.len(s) --gets string length (#of characters) | |
4 | for i=1, length, 1 do --Runs the code between do and end | |
5 | c=string.sub(s,i,i) --length #of times. length = #of char | |
6 | --string.sub() gets a substring | |
7 | --from index i, to index i. | |
8 | s=string.gsub(s,c,string.char(string.byte(c)+shift)) | |
9 | --string.gsub() substitutes any | |
10 | --character in s matching c with | |
11 | --string.char(…) | |
12 | - | > print(s) --prints the new string s |
12 | + | print(s) --prints the new string s |
13 | - | >end |
13 | + | end |