lua-users home
lua-l archive

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


On Thu, Mar 7, 2013 at 11:32 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> I append a "hello, world" demo. Just change the part defining your
> application. Note the whitespace before the closing double-quotes.

For extra marks, the curious can write a little Lua script which wraps
a Lua script as a C string and saves you some typing. You will have to
watch out for escapes, e.g. \\, \".

The _fun_ part is when you need something that isn't in the kit, like
luafilesystem. For that you have to edit linit.c in the Lua source and
add lfs, plus compile lfs.c and link that in as well. (Lua 5.2's
linit.c is easier to customize)  While you're there, you can leave out
some standard libraries that are useless/dangerous.

And that's basically the process that LuaBuild tries to automate.

The _headache_ part is when you have a whole Lua program, with modules
(some of which brought in from other libraries). Then Jay's soar can
help with making a single Lua file from the program (it can do both
static and dynamic analysis to work out what to put in the 'archive').
 Then lhf's srlua can glue that single Lua file to a custom stub
executable that contains the program's binary dependencies.  This
approach scales better than the simple encode-Lua-as-C method.

LB does not need C knowledge, but it does need a working compiler and
an existing Lua + lfs. (I had fun allowing for an initial bootstrap
step where it would use the Lua makefile to get enough Lua going to
start Lake ;))

steve d.