lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


It was thus said that the Great Valerio Schiavoni once stated:
> Hello
> is there anyone who hash a script (bash or others) that takes a .lua file
> and strips out all the comments (block, multiline, single line) ?

Would the following do the trick?

  -spc

#!/bin/bash

# You have to supply a filename, sans the ".lua" extension, else this will
# bomb out I don't know enough bash scripting to fix this.  Think of this as
# a "proof-of-concept".

cat <<EOF >$1
#!/usr/bin/env lua
EOF

luac $1.lua
cat luac.out >>$1
/bin/rm luac.out
chmod 755 $1
exit 0