lua-users home
lua-l archive

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


Kevin Vermeer wrote:
>
> A real-life example of code that would break in a different fashion, that I
> (and others, I'm sure) have used many times is code like the following line:
> 
> -- Get stdout stream by running "cmd", convert to string, and trim it.
> local cmd = io.popen "cmd":read "*a":gsub("^%s*(.-)%s*$", "%1")
> 
> The current policy allows the ':' operator to work as a pipe between these
> functions.  The proposed change would, unfortunately, try to call 'read' on
> the string "cmd" and gsub on the string "*a".

I'm not sure whether you are talking about may patch or Pavel's suggestion
but I can assure you, that my patch parses your example exactly like current
Lua and as you want it to be parsed.

Ciao, ET.