Hello,
Could someone of the Corona team verify that SpriteObject methods are not able to be extended/overridden? And if so, why is that? and will it ever be possible in the near future?
The problem is shown in the code below. I’m just testing setSequence here, but testing play/pause or setFrame won’t work either.
local testSheet = graphics.newImageSheet(INSERT\_OWN\_SHEET\_CONFIG\_HERE}) local testSprite = display.newSprite(testSheet, INSERT\_OWN\_SPRITE\_CONFIG\_HERE) print(testSprite.setSequence) -- Printing before override function testSprite:setSequence() -- Override print("extendedSetSequence") end print(testSprite.setSequence) -- Printing after override testSprite:setSequence("test") -- Calling the new function
After running this code, you will get 2 print messages mentioning the same function (eg. “function: 0x7ABC”, “function: 0xABC”). Also the “extendedSetSequence” print message is not shown.
Ps. extending DisplayObject function DOES work