lua-users home
lua-l archive

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


> De: Tomas <tomas@ccpa.puc-rio.br>
> Maybe in a next version we could have a syntatic sugar for that like:
> 
> localimport assert, ipairs, type
> 
>  	If we could find a good name for the keyword...

What about "capture"? After all you are capturing the globals as locals, no?

While the above syntax is not available, wouldn't it be possible to use something like

capture {"assert", "ipairs", "type"}

in Lua 5.x and make capture() define the names using setfenv?

One could also create a global table with the names to be captured, or maybe a call to capture without parameters would capture just those names...

If that works, one could write something like

module("m", capture(baseNames))

or 

module("m", capture)

But then maybe just making a function package.seebase could solve it... :o)

André