[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: FAQ? combining all modules into a single bytecode file
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Tue, 5 Aug 2008 23:06:53 -0300
> Wouldn't it make sense to implement [support for require] in luac?
I've written a version of luac in Lua that suports require:
It understands command lines such as:
lua luac.lua x.lua y.lua -L a.lua b.lua c.lua
This creates a precompiled chunk that preloads a.lua, b.lua, c.lua and
then runs x.lua and y.lua, which may require a, b, c.
The list of modules to run and the list of modules to preload are both
Since this is a Lua program, it can be modified to suit other needs,
such as returning all values returned by x.lua and y.lua, or sending all
run-time command line args to them, etc.
For added fun, the program has no comments :-) [but you may wish to
print the fake main program that it creates to see how it works]
All feedback welcome. Enjoy.