lua-users home
lua-l archive

Re: Recursive local functions

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


>What I'd love to see, is the ability to get a ref to the 'current'
>function, perhaps as an implicit variable, a bit like 'this' in java and
>C++.
>
>So that I could recurse by calling:
>	currentfunc()
>rather than messing about with tables etc.
Come to think of it, this already exists!
Write "getinfo(1).func" inline or define
 function currentfunc()
 return getinfo(2).func
 end
Yeah, metamechanisms instead of language features!
(Even I sometimes get suprised by how neat Lua is, if I say so myself...)
--lhf

AltStyle によって変換されたページ (->オリジナル) /