[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: Is a Lua system easily embeddable?
- From: "John Hind" <john.hind@...>
- Date: Sat, 5 Sep 2009 12:21:22 +0100
I think perhaps the issue here is that the Module system has encouraged a
move to writing libraries in Lua or in composites of Lua and C rather than
in pure C. This introduces an implicit assumption that the target
architecture will present a file system in which to store the Lua code, an
assumption that is not made by the Lua core or standard libraries.
This is easily fixed on the Windows environment because Windows executables
have support for embedded resources and it is straightforward to provide a
loader so Lua "require" looks for Lua code in resources. Unfortunately, this
is not portable to other platforms. Also unfortunately you cannot load dll
files from resources, so you still must statically link the C parts of
composite libraries (not usually any problem, but it would be nice ...)
This problem is not unique to Lua and it afflicts all "scripting" languages
(just look at how many files the Firefox browser tips into your file
system!). What's needed is a generic "meta-executable" format that embeds a
virtual file system and makes it available to a normal executable (in this
case a Lua runtime) stored in the same file. Any examples of such systems I
can find extract content out to temporary files, which rather spoils the
> -----Original Message-----
> From: email@example.com [mailto:lua-
> firstname.lastname@example.org] On Behalf Of Miles Bader
> Sent: 05 September 2009 11:47
> To: email@example.com
> Subject: Re: Is a Lua system easily embeddable?
> Andre de Leiradella <firstname.lastname@example.org> writes:
> >> How have they become different, except that the protocol for C
> libraries is
> >> now that they are called via lua_call instead of calling luaopen_xxx
> >> (However, this is just for some libraries that need environments.)
> > Based on what people said about how to statically link modules, I
> > to say things do have changed.
> Which "things," exactly? Be precise.
> In my experience, Lua is _extremely_ simple to use with static
> If you can't beat them, arrange to have them beaten. [George Carlin]