lua-users home
lua-l archive

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


It was thus said that the Great Enrique Garcia Cota once stated:
> 
> > o A key point that seems to be missing from #5 is that not everybody loads
> > modules from the filesystem. In our environment, we have two searchers, the
> > package.preload searcher, and our own custom searcher that searches an
> > SQLite3 database (our application deployment format). If your multi-file
> > module won't work if I concatenate all the separate files together, then
> > it's of no use to me. I think this can be achieved roughly as follows:
> 
> If I understand you correctly, you are basically describing a system where
> `require` doesn't work. I understand where you are coming from, but also be
> aware that there's a blurry line there - if you take enough features from
> Lua, is it still the same language?

  No.  require does work.  It has a mechanism allowing one to extend the
functionality (no monkeypatching required) to locate modules in other ways. 
You add a function to the array package.loaders[] that searches for the
module name (details in the Lua manual).

  This isn't monkeypatching because require is designed to be extended in a
controlled manner.  

  I've done something similar at work (only the modules are compiled into
the executable as compressed text).  

  -spc