Fed up with Movieclip.lua errors!!!!

Every time I try to create a movieclip all the screen shows is the first image. When I debug, it gives an error for the movieclip.lua file line 286:

/iPhone apps/movieclipTest/movieclip.lua:286: attempt to index local 'self' (a nil value)  
Runtime script error at file movieclip.lua line 286  

I have double checked my code and I still can’t find anything wrong with my code.
Here is my code:

  
local movieclip = require "movieclip"  
  
local myAnim = movieclip.newAnim({ "shark1HD.png", "shark2HD.png", "shark3HD.png" })  
  
myAnim.x = 120  
myAnim.y = 320  
  
myAnim.play()  

Is there anything I can do about this?
I assume it’s an issue with the external movieclip library, if so, does anyone have a newer movieclip.lua file that works? [import]uid: 38000 topic_id: 11557 reply_id: 311557[/import]

Only thing I can think of is that it can’t find/load one of your images, but I’m guessing you verified that the names are correct. [import]uid: 58455 topic_id: 11557 reply_id: 41972[/import]

Oh…from the docs, it says to call myAnim:play(), not myAnim.play(). I recreated your problem calling myAnim.play().

BTW, will movieclip be added to the SDK, or just as an add-on by including movieclip.lua in my project? [import]uid: 58455 topic_id: 11557 reply_id: 41974[/import]

There is an important, yet subtle, difference when calling a function using a . or a :

Essentially the : is just syntactic sugar to save you having to pass a reference to the object yourself.

object:function( value )  

Is the same as

object.function( object, value )  

If you wanted to use the . operator then change your code to this:

  
myAnim.play( myAnim )  
  

However using the : operator is easier and the convention so just use this:

myAnim:play() [import]uid: 5833 topic_id: 11557 reply_id: 41981[/import]