lua-users home
lua-l archive

Re: Injecting names & method chaining (was Re: [ANN] Penlight Libraries, First release)

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


On Fri, May 1, 2009 at 11:31 PM, David Manura wrote:
> Or in standard Lua, we could write a helper function like
>    chain(stringx, trim, 1,repeatchars,5, "  test  ")
Actually, more like chain(stringx, 'trim', 1,'repeatchars',5, 'upper',
nil, ' test ').
Another idea is chain(stringx):trim():repeatchars(5):upper()(' test
'), which may be preferable to the current approach in
MethodChainingWrapper. That even allows separation and reuse like
 f = chain(stringx):trim():repeatchars(5):upper()
 print ( f(' test ') )
 print ( f(' again ') )

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