lua-users home
lua-l archive

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


2009/9/3 John Hind <john.hind@zen.co.uk>:
> But why bother putting it in the preload table if you then immediately load it
> using C code? The idea of the preload table is so you can have C libraries compiled into
> the runtime but which only get loaded into the Lua environment if called for by
> the script. If you load it right off, you should load it like any of the standard
> libraries i.e. by just executing its loader function.

Loaders of the standard libraries are designed to be just executed.
Modules that are designed to be loaded through require may rely on the
extra features of require to work properly (ie. setting
package.loaded[modname] to the return value of the loader).