Log In  


It would be very handy if the built in tostr() was able to call the __tostring() metamethod for tables that have it defined. This is easy enough to add in our own code, but feels like it should be default behavior, similar to normal Lua.

1


Yes please!


1
local _tostr=tostr
local function tostr(n,...)
 if(type(n)=="table" and getmetatable(n) and getmetatable(n).__tostring)return getmetatable(n).__tostring(n,...)
 return _tostr(n,...)
end


[Please log in to post a comment]