lua-users home
lua-l archive

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


On Mon, Jun 15, 2015 at 9:18 PM, Aapo Talvensaari
<aapo.talvensaari@gmail.com> wrote:
>> On 2015-06-12, at 6:46 PM, Rena <hyperhacker@gmail.com> wrote:
>> > command = input:urldecode():lower():trim():split(' ')
>
>
> You can do this:
> command = filter.urldecode.lower.trim.split(' ')(input)
>
> One of the nice things about this is that the filter chain can be cached
> easily:
>
> f = filter.urldecode.lower.trim.split(' ')
> command = f(input)
> command2 = f(input2)

I have implemented this [1]. The only difference is that methods with
parameters are applied with colon not with dot. If a method with
parameters was applied with dot, then it would be indistinguishable
from the application of the pipe itself.

[1] https://gist.github.com/starius/d72f5b2ddc5fd4bf2460



-- 


Best regards,
Boris Nagaev