lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2014-03-31 19:42 GMT+02:00 Philipp Janda <siffiejoe@gmx.net>:

> Sadly we don't have `rawtostring` available in Lua, so this specific example
> is difficult, but in principle it should work ...

rawtostring = function(value)
   local mt=getmetatable(value)
   if not mt then return tostring(value) end
   debug.setmetatable(value,nil)
   local str=tostring(value)
   debug.setmetatable(value,mt)
   return str
end