lua-users home
lua-l archive

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


I have implemented a Lua (5.1.1) userdata that implements the __concat metamethod. A simplified form of my testcase is as follows:

	result = userdata..number
--      result = number..dispatch
        result = dispatch..userdata
        result = userdata..table
        result = table..userdata
        result = userdata..boolean
        result = boolean..userdata
        result = userdata..string
        result = string..userdata
        result = userdata..func
        result = func..userdata
        result = userdata..thread
        result = thread..userdata

where userdata is a variable containing my userdata object (and number, table, boolean, func and thread are variables containing the corresponding Lua type). Everything works as expected but for the commented out case

	result = number..userdata

In this case the number is automatically 'promoted' to a string type before my metamethod is called. Is this behaviour correct because this is not as described by my reading of section 2.8 of the manual?

Paul.