lua-users home
lua-l archive

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


>>>>> "LHdF" == Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> writes:

 >> the better way is having the hook which should be called from
 >> VM/libraries when they need the file be loaded I guess.

 LHdF> If I understand you correctly, that's the idea of package.preload:
 LHdF> 	http://www.lua.org/manual/5.1/manual.html#pdf-package.preload

Not exactly, the main problem is that the Lua VM is not living
forever. it's started on demand and dies as soon as request
processed. I can create the pool of the VMs, it's not a
problem but it leads to another problem - how can I share
`package' table between all VMs? How can I share the code
compiled and being executed in one VM with another one? How can
I invalidate compiled code when disk file has been changed? How
can I throw away the expired code from the cache? I'm afraid
only by full replacement of the `require' function as it is
now. maybe I'm wrong.

-- 
Yours sincerely, Eugeny.
Doctor Web, Ltd. http://www.drweb.com