Tamale – a TAble MAtching Lua Extension

Tamale is a Lua library for structural pattern matching – kind of like regular expressions for arbitrary data structures, not just strings. (Or Sinatra for data structures, rather than URLs.)

tamale.matcher reads a rule table and produces a matcher function. The table should list {pattern, result} rules, which are structurally compared in order against the input. The matcher returns the result for the first successful rule, or (nil, "Match failed") if none match.

https://github.com/silentbicycle/tamale

Advertisements