|
Am 17.08.2014 um 20:22 schrieb Thiago L.:
On 17/08/14 03:09 PM, Philipp Janda wrote:Don't forget: __tostringI thought __tostring was a fallback... (Lua doesn't know what to do, but instead of throwing an error it returns the memory address or a hash or w/e)
debug.setmetatable( 1, { __tostring = function( v ) return "X"..v.."X" end } ) print( 1, 2, 3 ) ==> X1X X2X X3X Or my favourite: debug.setmetatable( "", { __tostring = function( v ) return "bye bye" end } ) print( "hello world" ) ==> bye bye Philipp