SHOW:
|
|
- or go back to the newest paste.
1 | - | args = {...} |
1 | + | function build(data) |
2 | - | |
2 | + | local t=data |
3 | - | if #args > 0 then |
3 | + | |
4 | - | print("Converting files...") |
4 | + | |
5 | - | for i = 1, #args do |
5 | + | |
6 | - | t = '' |
6 | + | |
7 | - | f = io.open(args[i],'r') |
7 | + | |
8 | - | if(f ~= nil) then |
8 | + | |
9 | - | for l in io.lines(args[i]) do |
9 | + | |
10 | - | t = t..l..'\n' |
10 | + | |
11 | len = 1 | |
12 | - | |
12 | + | |
13 | t, len = string.gsub(t,'if(.+){(.+)}','if %1 then %2 end') | |
14 | end | |
15 | len = 1 | |
16 | while len > 0 do | |
17 | t, len = string.gsub(t,'function(.+){(.+)}', 'function %1 %2 end') | |
18 | end | |
19 | return t | |
20 | end | |
21 | print(build) | |
22 | return build |