This solves the use case of matching against complex, unpredictable error objects. It's a common idiom in Lua to throw error objects that implement the __tostring metamethod. In many cases it will be more convenient to match against these errors using strings. First, it has the advantage of hiding how the error is implemented. And second, it's the only way to match against error objects that contain unpredictable data (which is common when you decorate your errors with context/system-specific data).
This only affects error objects (i.e. tables) that implement the __tostring metamethod, and it's still possible to match table-against-table if you wish.
This solves the use case of matching against complex, unpredictable error objects. It's a common idiom in Lua to throw error objects that implement the __tostring metamethod. In many cases it will be more convenient to match against these errors using strings. First, it has the advantage of hiding how the error is implemented. And second, it's the only way to match against error objects that contain unpredictable data (which is common when you decorate your errors with context/system-specific data).
This only affects error objects (i.e. tables) that implement the __tostring metamethod, and it's still possible to match table-against-table if you wish.