lua-users home
lua-l archive

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



Is there a way to get luac.exe to compile <all> files required by the
source? For example, if I have the following file:

I'd say the solution to your problem is to leave the extensions of the scripts you require. So, instead of:

	require "bar.lua"

use:

	require "bar"

Now you can simply tweak your require path to select either the .lua or .luac versions of your code.

In fact, nothing stops you from using a search path that handles both at the same time (and, for instance, gives precedence to the non-compiled .lua versions)!

I'm using a similar setup and this works great: the only thing I need to do to create a deployable version of any of our products is compile and pack the required scripts. Even though I only deploy compiled scripts at customer sites nothing is ever changed to the sources.

Of course, another aspect of your situation may be to actually know which scripts you need to compile. A trick you could use here is to write/use a small require replacement that logs whatevers required (when your system starts/runs).

Ashwin.
--
no signature is a signature