lua-users home
lua-l archive

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

On Wed, Nov 2, 2011 at 16:29, Petite Abeille <> wrote:
> 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 =
> = function( filename, mode, ... )
>  -- do stuff depending on mode
>  -- or default back to the standard implementation
>  return ioopen( filename, mode )
> end

One of my favourite features of Lua is you can replace anything. You
could add support for reading zip files transparently by replacing and friends with your own wrappers, for example. Talk about
"drivers" that seem to be meant to define how functions behave seems a
bit redundant when you can change their behaviour already by replacing

Also, I'd definitely want "chdir" rather than "cd". Readability is good.

Sent from my toaster.