lua-users home
lua-l archive

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


On Nov 2, 2011, at 11:11 PM, Patrick Rapin wrote:

> 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.
> And I could have written a driver for our printer firmware pseudo file
> system, instead of removing the "io" library and writing a custom
> binding.

FWIW, I like Georg Lehner proposal as well :)

That said, one could easily "virtualize/overload" the existing io module to suit its need.

For example:

local io = require( 'io' )
local ioopen = io.open

io.open = function( filename, mode, ... )
  -- do stuff depending on mode

  -- or default back to the standard implementation
  return ioopen( filename, mode )
end