lua-users home
lua-l archive

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


> I would oppose that argument.  It's a lazy solution in some special
> (though admittedly common) cases, but using it delays the rate at
> which you master Lua patterns.

string.gmatch in particular is very powerful, definitely worth the
initial effort.

However, it is easy to write a broken split(), which is of course why
we have the Wiki ;) I once formulated a rule that every non-trivial
Lua program has at least one version of split() defined in it
somewhere.

> Problem       -->    Python solution
>   |                       |
>   V                       V
> Lua solution  <--  Python-to-Lua thinking

Hah, that is so true. I went around this loop too much when doing
Penlight, and the code became clearer and less entangled when I
stopped doing it reflexively.

steve d.