lua-users home
lua-l archive

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


Jamey Cribbs wrote:
> Ignacio Castaño wrote:
> 
> >I'm anoyed with the amount lua extensions out there. With lua extensions
I
> >mean lua binaries that are linked with different libraries. The problem
with
> >this approach is that you cannot use lua with two different libraries at
the
> >same time. The only solution is to build your own lua, and that's only
> >possible if the source code of the libraries is publically available.
> >To solve that I would like to see a standard mechanism to write dinamic
> >libraries for lua. The requierements of that mechanism are very simple:
> >
> >- A single entrypoint in the library: (i.e. Register(lua_State *) ) where
> >all the lua functions are exported.
> >- A new function in iolib (i.e. loadlib )
> >
> >so you could do:
> >
> >>loadlib "wxlua"
> >>
> >
> >and that would load the library, call the Register function, and add the
> >library to a table of loaded libraries, so that multiple calls to loadlib
do
> >not load the library multiple times.
> >
> I was thinking about the exact same thing last night. I was surfing the 
> web and I noticed that the author of SQL-Lite had a dynamic library that 
> you could call from Tcl to access his dbms. I started thinking about 
> all of the libraries that are available for Tcl and how easy it is to 
> use them (just type "load mylib.dll"). I wish Lua had this.
> 
> I was thinkg along the same lines as Ignacio (but less technically, 
> because I don't understand exactly how it all works). I know loadlib 
> lets you call dlls. So if someone could maintain a compiled binary of 
> "base" lua + loadlib, and then all of the extension authors could 
> provide their library in the form of a dll that could be accessed 
> through loadlib, this would give the lua community the same "ease of 
> use" and functionality that Tcl now enjoys.
> 
> This would also satisfy a lot of the people, like me, who don't 
> necessarily want to learn the ins and outs of C compiling. We just want 
> a version of lua that has the libraries that we need.
> 
> Thanks, Ignacio, for bringing this up!

Actually, this subject comes from time to time in this mailing list. It has
no interest for those using Lua embedded in their applications or in small
systems, but it is paramount for those using Lua as a system scripting tool.

Note that this is not as simple as just having loadlib available.
I imagine a socket library, a thread library, an OpenGL lib., etc., all can
have a function named sleep, for example.
So just blindly loading all these libraries at once will lead to an
undefined state.
As Nick mentioned:
> I agree this would be sensible. It would be nice if loadlib were adopted
by
> the Lua community and modifed into a framework for writing standard
modules.
> eg. skeleton code, examples and docs. With maybe something similar to ppm
in
> time.

we need to formalize a system like Perl's one (seems quite successful for
allowing quite a big number of libraries to exists) or Tcl one, etc., no
religion on this point.
A system allowing, of course, to load a library, but also formalizing a way
to specify the default path of such library (probably using an environment
variable), to specify namespace (perhaps Roberto's LTN can be used as such),
and to avoid other problems I will probably overlook.
Perferably, of course, all this must be portable, ie. should work in an
identical way in all systems, to avoid tweaking a plain Lua program to work on
our system.

Regards.

-- 
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--

Sent through GMX FreeMail - http://www.gmx.net