lua-users home
lua-l archive

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

> 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)

-- Roberto