lua-users home
lua-l archive

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

> > I suggest a more flexible scheme: in stdlua.lua (or whatever the
> > name is), test whether a table called "stdlua" exists. If it does,
> > then stdlua.lua should define only those functions whose name
> > appear in the table. In this way, users can choose the functions
> > they need.
> I'm not sure how useful this will be in practice.  Is the point to shave
> bytecodes?  Maybe it's not an issue for the intended audience.  
> Furthermore
> in utility libraries I've written, functions often have interdependencies.
> Allowing the user such control may break things depending on the
> implementation.

I may seem to cut hairs in four parts (as we say in French: "Couper des
cheveux en quatre"), by the length of course, but shaving bytecodes can be quite
Sorry, I couldn't resist for the (bad) pun. I just come out of the

OK, more seriously, you are quite right.
Now, if this idea have some success, it can be necessary, some day, to break
the file in parts. A generic one, that can be used by various functions, a
file I/O one, a string one, an encoding/decoding one, etc.

Perhaps a generic file will load the required libraries, based on a table,
in a similar idea to Luiz' one.

I am not sure if it is a good idea: how to break down the file? What about
dependencies, as you indicate? We can force a dofile to be sure to have
required functions, but I wonder what happens if a.lua has a dofile("b.lua") and
b.lua has a dofile("a.lua")...
Anyway, the idea of loading a 100KB file to be able to dump a table for
debugging isn't so terrific either...

I can always cut/paste the code, but:
1) It will be frozen, ie. updates are quite hard to do, even more if used in
several scripts. At least, we can be sure it won't be broken by a hazardous
2) We lose the interest of such a file, where we just have to type a line to
get a much used functionality.


Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist

Sent through GMX FreeMail -