Re: Should split be in Lua? (Was: Extracting list of items from line?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Should split be in Lua? (Was: Extracting list of items from line?
- From: steve donovan <steve.j.donovan@...>
- Date: 2011年4月18日 12:51:29 +0200
> 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.