lua-users home
lua-l archive

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

2007/9/25, Luiz Henrique de Figueiredo <>:
> > Now we want to precompile the code instead of keeping it all as source.
> See

You can also use the package.preload table if you need/want to keep
the embedded/packaged source files identical to the original ones.

Instead of puting your module in a file, you have to load it (with
lua_loadstring for example), and put it in the global table
package.preload with the full modulename as a key. You then call your
main script normally, and all existing 'require' calls will find the
modules in their new place automatically instead of looking for
external files.