lua-users home
lua-l archive

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

As you say Jerome, it is easy enough to internalise the "C" parts of the library (as long as you have the source and it is well written). But this is not true of the Lua bits.

This is actually why I tend to swim against the stream on this one and implement as much as possible of the "infrastructure" in C leaving Lua for specific application code. The ability to use the Lua API as a kind of C toolkit means it is quite easy to translate a Lua prototype into C.

I wonder if it would be possible to make some kind of container file something like a zip where an exe file was executed and presented with a filesystem completely embedded within itself. Then you could put Lua and DLL files into that embedded file system and have them discovered and loaded using the existing Lua mechanisms ...

> -----Original Message-----
> From: [mailto:lua-
>] On Behalf Of Jerome Vuarand
> Sent: 04 September 2009 11:08
> To: Lua list
> Subject: Re: Wishlists and Modules (was [ANN] libmc)
> 2009/9/4 Andre de Leiradella <>:
> > Take a look at http.lua from LuaSocket:
> >
> > ---------------------------------------------------------------------
> --------
> > -- Declare module and import dependencies
> > ---------------------------------------------------------------------
> ----------
> > local socket = require("socket")
> > local url = require("socket.url")
> > local ltn12 = require("ltn12")
> > local mime = require("mime")
> > local string = require("string")
> > local base = _G
> > local table = require("table")
> > module("socket.http")
> >
> > ...
> >
> > I simply don't know how to "internalize" LuaSocket into an
> executable. It
> > doesn't seem that executing its loader function is enough.
> >
> > Please don't get me wrong, LuaSocket is a great library, it's just
> that I
> > don't seem to find a way to make it into my application the way I
> want it
> > to.
> LuaSocket is a perfect example where using package.preload and require
> is just as simple if not simpler than trying to load everything
> yourself. Just put all the LuaSocket module loaders in the preload
> table. For C modules, use the luaL_preload function I gave earlier.
> For the Lua modules, use luaL_loadbuffer instead of lua_pushcfunction.
> I don't know how to be more explicit. Tell us if it's still not clear
> enough.
> I think this is simple enough. Modules, packages, or whatever you call
> them have interdependencies. There is now a mechanism to express these
> dependencies at runtime. All you have to do is to make the modules you
> may need indirectly (you want socket.http but it needs socket.url) to
> be available somehow, and between all the existing searchers and the
> ones you can add there is plenty of freedome to pick what is the
> simplest for you. You may be used to the old way of doing things, but
> from the point of view of someone that started using Lua at the
> release of 5.1, the old way doesn't look any simpler even in embedding
> contexts.