lua-users home
lua-l archive

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

On Wed, Oct 19, 2011 at 8:33 AM, Philipp Janda <> wrote:
On 18.10.2011 05:53, Tang Daogang wrote:
On Tue, Oct 18, 2011 at 11:04 AM, Norbert Kiesel<>wrote:

;) I am sorry, Bamboo relies on lglib (,
in which I override the __add method with ..

Not a good idea if your strings look like numbers:

$ cat > adds.lua
local mt = getmetatable( "" )
mt.__add = function( a, b )
 return a .. b
print( "1" + "2" )

$ lua adds.lua

Lua tries to convert arguments of '+' to numbers and apply numeric addition *before* metamethods are involved.

That is true. I think this is lua's flaw, thanks for your mention, let me think how to treat this case.

Nothing is impossible.