external lua file to display an image and have a public function to rotate it

After reading the blog by JB about the new way to code external “modules”, I have given this a try to display an arrow graphic. I am getting the arrow to display OK but the function to set the rotation is not working. The setRotation is definitely being called.

Any ideas what I am doing wrong?

I had posted more or less the same question on the blog but thought it would get more coverage here on the forum and would be of help to others trying to figure out this stuff.
arrow.lua

  
local arrow= {}  
local arrow\_mt = { \_\_index = arrow } -- metatable  
-------------------------------------------------  
-- PUBLIC FUNCTIONS  
-------------------------------------------------  
  
function arrow.new( xPos, yPos ) -- constructor  
  
 local newArrow = display.newImageRect("images/guidearrow.png", 128,128)  
  
 newArrow.x = xPos  
 newArrow.y = yPos  
  
 return setmetatable( newArrow, arrow\_mt )  
  
end  
function arrow:setRotation(passedRotation)  
  
 print ("rotate")  
 self.rotation = passedRotation  
end  
return arrow  

main.lua

[code]

local arrowClass = require(“arrow”)
local arrow1 = arrowClass.new( 250,250 )
arrow1:setRotation(45)

[/code] [import]uid: 7863 topic_id: 16035 reply_id: 316035[/import]

Think I may have sussed it:

  
local arrow= {}  
local arrow\_mt = { \_\_index = arrow } -- metatable  
-------------------------------------------------  
-- PUBLIC FUNCTIONS  
-------------------------------------------------  
  
function arrow.new( xPos, yPos ) -- constructor  
  
 local newArrow = {  
 imagery = display.newImageRect("images/guidearrow.png", 128,128)  
  
 }  
  
 newArrow.imagery.x = xPos  
 newArrow.imagery.y = yPos  
  
 return setmetatable( newArrow, arrow\_mt )  
  
end  
function arrow:setRotation(passedRotation)  
  
 self.imagery.rotation = passedRotation  
  
end  
  

Seems to work but not sure I am going about this the best way:) [import]uid: 7863 topic_id: 16035 reply_id: 59531[/import]