Lua is very flexible and very fun to hack! With a different approach [0], you can get a switch on tag that feels more like a "standard" switch statement, eg.:
result = switch(shape) {
rectangle = function(r)
return "a rectangle with width " .. r.width
end,
function(s)
return "an unknown shape"
end
}
Can't easily get rid of the pesky functions, though.
[0]: https://gist.github.com/krajzeg/9bd8806fb72c1ae22eb931b42b3d...