[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Storing Lua code in a C library
- From: Patrick Rapin <toupie300@...>
- Date: Wed, 23 May 2012 10:15:19 +0200
> I guess leaving it out of Lua is
> not much gain in most situations, but that's the decision of whomever
> is compiling their own Lua executables. I just like my programs to
> have as few dependencies as possible.
Removing the compiler from the Lua build is certainly very uncommon.
Even for embedded devices, the compiler is IMHO very useful if not the
main reason to choose Lua language (having a full scripting engine for
only about 150 kB). at Olivetti, we would never have chosen Lua for
our printers nor for other embedded applications if we needed to
precompile the scripts before running them on the device.
That said, developers removing Lua compiler from their device know
what they are doing and won't use your program anyway (if they care
about 60 kB, they won't integrate third party libraries unless really
necessary).
I would definitely recommend to store Lua scripts in source form
embedded in a C file, for example in the form Steve explained. This is
easier, more portable and more compact than the bytecode format. Tools
like LuaSrcDiet[1] can stretch that embedded source code. Personally,
I am used to compress the source code with ZLib, and uncompress it
dynamically in the luaopen_* library function.
[1] http://luasrcdiet.luaforge.net/