lua-users home
lua-l archive

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



To make sure I wasn't misunderstood:
- this method is totally up to the module (how it defines the table it returns); Lua or require need not do anything about it.


On Wed, 11 Oct 2006 11:14:59 +0300
 askok@dnainternet.net wrote:

There's been discussion about initializing only certain parts of a module, or initializing it in a certain way.

I just came to try whether the title syntax would work, and it does!

    require "module""feature"
    require "module"{ "feature1", "feature7" }

Has anyone used this already (is this old stuff?) and is there any downsides to it? The idea would be for 'require' to attach a '__call' metamethod to the table it returns, which would in turn handle string and table-of-strings to initialize certain parts of the system.

function a() return function(str) print(str) end end
a"hey"("hh")
hh
a"hey" "hh"
hh
a"hey""hh"
hh
a"hey"{ "hh", "uu" }
table: 0x309e20


-asko