Refactored table formatting
Refactored table formatting

This fixes a number of problems with the old implementation, which
used gsub on result to fix up formatting.

o-lim/luassert,ZyX-I/luassert,tst2005/lua-luassert,mpeterv/luassert