[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Proposal: Virtualization of Filesystem Operations for Lua 5.2.
- From: Sean Conner <sean@...>
- Date: Thu, 3 Nov 2011 01:07:31 -0400
It was thus said that the Great Patrick Rapin once stated:
> It is probably already too late to introduce a small feature in the
> upcoming Lua 5.2, so such a big feature will have to wait until at
> least Lua 5.3 ...
> This apart, I like very much that proposal. If such a file system
> visualization existed in 5.1, I could have used it to load modules
> from a ZIP file, instead of patching Lua source code.
You need to modify Lua sources to do that? Just add an entry to
package.loaders to scan a ZIP file for modules.
package.loaders
A table used by require to control how to load modules.
Each entry in this table is a searcher function. When looking for a
module, require calls each of these searchers in ascending order,
with the module name (the argument given to require) as its sole
parameter. The function can return another function (the module
loader) or a string explaining why it did not find that module (or
nil if it has nothing to say).
No direct modification of Lua required.
-spc (Unless there's something I'm missing ... )