-- Lua code formatter -- Removes tabs and checks lines arent too long. -- Nick Trout -- $Header: /Tools/build/codefmt.lua 3 16/08/01 20:00 Nick $ -- For Lua 5.0 mytabs = 4 -- spaces (default) myindent = 4 -- spaces (default) codetabsize = 8 -- spaces codeindent = 2 -- spaces per indent codelinelength = 80 -- characters usage = [[ Usage: lua -f codeformat.lua ...options... Options are: --file --ts , tabsize: number of spaces in your tabs --in , indent size: number of spaces for each indentation ]] function process_args() -- get args set by user in command line local t,i = {},1 while icodelinelength then print("-- ######## Line too long ("..len.." chars) ######## :") end print(line) f:write(line.."\n") end end --args = process_args() --if not args.filename then error(usage.."no Lua file given") end args = {} args.mytabsize = mytabs args.myindent = myindent process( readfile("System/PearOS.lua") )