lua-users home
lua-l archive

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


Thomas Lauer wrote:
>
> Such an extension to the current model could perhaps be implemented with
> a table as require()'s parameter. Most, if not all, fields would be
> predefined, so as to standardise usage. Ideas would include:
>
> require("syslog")       -- would still work, with same defaults as now
> -- or alternatively
> syslog.name="syslog"
> syslog.loadmethod="lua" -- could also support a pointer to a function
> syslog.location="http://localsite/";
> syslog.param={"whatever"}  -- could be used for module initialisation
> require(syslog)
>
> There are certainly other things one could think of.
>
> Such an approach would basically parameterise the "monolithic"
> require(). And if the loaded module gets this table as well, it could
> get information about how and where it was loaded, what parameters were
> used etc.
>
>   

Maybe I am missing something, but can't this be done w/the existing
require?  Like this:

syslog = require("syslog")
syslog.location = "http://localsite/";
syslog.param = {"whatever"}