[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Function as metatable (metafunctions?)
- From: Dirk Laurie <dirk.laurie@...>
- Date: Mon, 31 Mar 2014 20:39:21 +0200
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