lua-users home
lua-l archive

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


Gang, I looked at an implementation of a method that I have in my  app:

	__index = function(object, key)
			local result = SpriteMethods[key] or
				AnimationMethods[key]
				
			if result == nil then
				result = (ObjectTables[SSGetUserDataObjectPtr(object)] or {})[key]
				if result == nil then
					result = IdentityMethods[key] or
						ObjectMethods[key] or
						AdvanceableSpriteMethods[key]
				end
			end
			
			return result
		end,


Once I saw it again (I wrote it quite some time ago) I thought, isn't that equivalent to:

	__index = function(object, key)
			return SpriteMethods[key] or
				AnimationMethods[key] or
				(ObjectTables[SSGetUserDataObjectPtr(object)] or {})[key] or
				IdentityMethods[key] or
				ObjectMethods[key] or
				AdvanceableSpriteMethods[key]
		end,

Since I've been concentrating on the non lua parts of my app for a while now, I just wanted to double check that the two versions of the method are indeed equivalent...

thx,
ando




Ando Sonenblick
   SpriTec Software
      ando@spritec.com

Come learn about Sprite Studio: The paradigm-shifting 2D Multimedia Authoring Environment for creating...

• Web Content: Animated GIF Banners, JPEGs, Linear Flash Movies, and more • QuickTime Content: Titling, Transitions, Post Processing Effects, and more • Desktop Content: Custom, Fully-Interactive, Graphic- and Animation-Intensive Mac/PC Desktop Applications

It's all at:  http://www.spritec.com