lua-users home
lua-l archive

Re: precompiling

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


Luiz Henrique de Figueiredo wrote:
> Stephen Dekorte wrote:
> >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
> [...]
I guess he meant something different. More like
function dofile(name)
 local cname = name .. ".luac"
 if not exist(cname) or isolder(cname,name) then
 compile_and_dump(name,cname)
 end
 dofile(cname)
end
It's doable but I don't know if anybody has made it.
Ciao, ET.

AltStyle によって変換されたページ (->オリジナル) /