lua-users home
lua-l archive

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

On Fri, Sep 24, 2010 at 9:50 AM, Scott Vokes <> wrote:
>   I'm not set on testing strings with :match rather than just ==,
> either. Perhaps it could be activated by an optional optional
> match=true flag on the pattern row, like { "foo %d+", handle_num,
> match=true } ?

That does prevent having a pattern {a, b} where where a should be
matched as a literal string and b should be matched as a string

>   Would it suffice to add a row flag, "partial=true", to allow the
> table value being matched to have more elements than the pattern?

It might, but again, these row flags tend to limit
expressiveness--e.g. having a pattern {a, b} where a is matched fully
and b is matched partially, or having a pattern that fully matches the
array part of a table but ignores other fields in the table.

>   I'm planning on adding a special case for a variable V"...", which
> captures the remaining of the array-portion values: with { V"a", V"b",
> V"..." }, {1, 2, 3, 4, 5} would match to {a=1, b=2, ["..."]={3, 4, 5}}.

Yes, although a similar thing may be needed for the hash-portion.