[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Number 2 String( LUA_NOCVTN2S ) and numbers and concat...
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 27 Mar 2015 12:40:03 -0300
> Perfomance Question:
> I'm not *that* concerned about concatenation performance, but I am
> curious to know if the presence of a metatable slows Lua down for all
> numbers, or not. I figured that someone here might know that off of
> the top of their head and save me some bench marking time effort, in
> the case that it does not.
A metatable for numbers would not affect performance at all. But you do
not need it; you can use the string metatable :-) A quick hack could
be like this:
getmetatable''.__concat = function (a,b)
return tostring(a) .. tostring(b)