[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: method overloading?
 
- From: PA <petite.abeille@...>
 
- Date: Mon, 31 Jan 2005 12:51:04 +0100
 
On Jan 31, 2005, at 02:51, skaller wrote:
So I think your solution is right because it is most general.
Sounds good :)
In practice, this approach seems to be quite effective as well:
        -- instance method to copies all the key-value pairs from the 
given map
        this.putAll = function( aMap )
                if this.isKindOf( aMap ) then
                        local   someKeys = aMap.keys()
                        local   count = someKeys.size()
                        for index = 1, count do
                                local aKey = someKeys.get( index )
                                local aValue = aMap.get( aKey )
                                this.put( aKey, aValue )
                        end
                elseif type( aMap ) == 'table' then
                        for aKey, aValue in aMap do
                                this.put( aKey, aValue )
                        end
                end
                return this
        end
Cheers
--
PA, Onnay Equitursay
http://alt.textdrive.com/