tweaked the code of table.tostring() do that it can be used immediatelly in plain Lua