github.com/hirochachacha/plua@v0.0.0-20170217012138-c82f520cc725/stdlib/base/testdata/tostring.lua (about) 1 assert(tostring("test") == "test") 2 assert(tostring(13) == "13") 3 4 x = setmetatable({name = "name"}, { 5 __tostring = function(t) 6 return t.name 7 end 8 }) 9 10 assert(tostring(x) == "name")