lua-users home
lua-l archive

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



>> > 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'm sorry, I would want to know if the patch I've proposed (the one in the subject) can also solve this problem:

f = function(str) -- do something with str
        return str:upper:lower .. "one"
end

str = "Testing This "
str = f(str)

f2 = function(str) -- example given
       return str:urldecode:lower:trim:split(' ')
end

command2 = f2(input2)

that also solves the problem?

because with this you can easily understand that ":" are function calls, and not confuse with "." syntactic sugar.



--
Rodrigo Azevedo Moreira da Silva