[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: precompiling
- From: Stephen Dekorte <steve@...>
- Date: Mon, 15 May 2000 17:44:14 -0700 (PDT)
On Mon, 15 May 2000, Luiz Henrique de Figueiredo wrote:
> >Is there any way to access the precompiler from within lua?
> Lua always precompiles chunks before running them.
> >I want to have my lua code precompile files before executing dofile()
> >so the next time the script is run it will run the precompiled version
> >if this source file hasn't changed.
> The easiest solution for this is to define a function around the whole chunk
> and return it. Something like
> return function ()
> ... (chunk code)
> Then do
> if CACHE[name]==nil or file "name" has changed then
I guess I wasn't clear - I need to write out the precompiled chunk to
a file from within lua.
In other words, with luac I can do this:
luac -o MyFile.luac -c MyFile.lua
and produce a MyFile.luac file that contains a precompiled version of
MyFile.lua. But could I do the same thing in lua without using a