lua-users home
lua-l archive

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


On Mon, Sep 26, 2011 at 05:05:41PM +0000, KR wrote:
> steve donovan <steve.j.donovan <at> gmail.com> writes:
> 
> > 
> > 2011/9/26 Artur Galyamov <artur-pub <at> yandex.ru>:
> > >     local min, max, floor in math
> > >
> > > No new keywords there. I think it would be nice way to easily localize
> globals.
> > 
> > Yes, it's convenient. I agree with Dirk actually that it's not worth
> > adding new keywords for this convenience, but it _is_ less ugly than
> > the full version.
> > 
> > steve d.
> 
> I think this proposal is quite convenient. At the moment I do something like:
> 
> local min, max, sin, cos = ridx(math, "min, max, sin, cos")

Nice trick. You could also make rdix a table with a special metatable so
that the following works too

local min, max, sin, cos = from.math "min, max, sin, cos"

But of course you have to repeate the function names twice...

Cheers
-- 
Enrico Tassi