lua-users home
lua-l archive

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

I have a situation where I want to distribute a Lua script as part of a shell 
script package. The Lua script needs to be as small as humanly possible, but 
doesn't have to be editable.

Any suggestions?

The traditional thing to do with C in this case is to run the source through a 
cruncher; this will strip out comments and whitespace, and the really good 
ones will rename all your identifiers to be as short as possible. Identifier 
renaming in a language as dynamic as Lua is probably going to lead to a 
World-O-Pain(TM), but the rest would still likely be useful, and not 
particularly difficult.

To my surprise, running the script through luac makes things *bigger* --- 
presumably due to inefficient opcode encoding. Can anyone suggest any other 
strategies I could adopt? (I'm already using gzip to compress the final 

+- David Given --McQ-+ "There is no expedient to which a man will not
|    | resort to avoid the real labour of thinking." ---
| ( | Thomas Edison
+- --+ 

Attachment: pgpNpy2olwaU2.pgp
Description: PGP signature