[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: question regarding caching of scripts
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Sat, 20 Mar 2004 10:11:47 -0300
> if it does not cache scripts, is there some easy and efficient way to
> implement this?
If you're loading scripts from files, try this:
do
local T={}
function run(s)
local f=T[s]
if f==nil then
local e
f,e=loadfile(s)
if f==nil then return f,e end
T[s]=f
end
return f()
end
end
Of course, this code assumes that files will not change once they loaded.
--lhf