lua-users home
lua-l archive

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


> > LuaSrcDiet reduces the size of Lua 5 source files by removing all
> > unnecessary whitespace and comments.
>
> I'm intrigued; given luac, why would one want such a thing?

I'm not sure about his motivations, but I see two reasons: one is that
precompiled chunks are not always smaller than the original source, because
of debug information, for instance; the other is that you may want to
store Lua code as a string inside your code and using source instead
of precompiled code will give you portability, because the format of
precompiled code changes with each version. I think tolua did this.

Shameless plug: my ltokens library comes with a lstrip tools that does
exactly what LuaSrcDiet does but uses the Lua lexer for that.
--lhf