Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- args = {...}
- if #args > 0 then
- print("Converting files...")
- for i = 1, #args do
- t = ''
- f = io.open(args[i],'r')
- if(f ~= nil) then
- for l in io.lines(args[i]) do
- t = t..l..'\n'
- end
- len = 1
- while len > 0 do
- t, len = string.gsub(t,'while(.+){(.+)}', 'while %1 do %2 end')
- end
- len = 1
- while len > 0 do
- t, len = string.gsub(t,'for(.+){(.+)}', 'for %1 do %2 end')
- end
- len = 1
- while len > 0 do
- t, len = string.gsub(t,'if(.+){(.+)}','if %1 then %2 end')
- end
- len = 1
- while len > 0 do
- t, len = string.gsub(t,'function(.+){(.+)}', 'function %1 %2 end')
- end
- f:close()
- f = io.open(args[i]..'.out', 'w')
- f:write(t)
- f:close()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement