2 objects wont move OOP

I can already create 1 enemy that moves but for some reason I cant get 2 enemies to move. The images display but no movement or just 1 image moves.

[lua]main.lua

local loadenemy = require( “enemy” )

local enemy1 = loadenemy.enemy:new(1,50,60);
local enemy2 = loadenemy.enemy:new(2,140,190);
enemy1:printnum();
enemy2:printnum();

local function gameLoop(event)
enemy1:moveEnemy(); – this doesnt move???
enemy2:moveEnemy();
end

Runtime:addEventListener(“enterFrame”, gameLoop)


enemy.lua

module(…, package.seeall)

enemy = {
}

enemy.__index = enemy

function enemy:new(i,x,y)
local o = {
num=i;

}

self.startx=x;
self.starty=y;
self.num=i;
self:loadimages();
setmetatable(o,self)
return o;
end

function enemy:printnum()
print (“enemy num=” … self.num)
print (" image y val=" … self.img.y)
end
function enemy:loadimages()

self.img= display.newImage(“ship1c.png”)
self.addx=1;

self.img.x=self.startx;
self.img.y=self.starty;
end

function enemy:moveEnemy()
– self.img.x=self.img.x +self.addx;
self.img.x=self.img.x + 1;

end[/lua] [import]uid: 138547 topic_id: 25528 reply_id: 325528[/import]

I am reaLLY not getting classes in lua as I cant create separate instances when images are involved in each instance of a class. The images will display but I have no
control over movement of second image.

[import]uid: 138547 topic_id: 25528 reply_id: 103219[/import]

I solved my problem.
You cant have constructors that call functions. I need to use a constructor just to initialize variables you pass to it.

[lua]correct
local enemy1 = loadenemy.enemy:new(1,50,60);
enemy1:loadimages()
local enemy2 = loadenemy.enemy:new(2,140,190);
enemy2:loadimages()

correct

function enemy:new(i,x,y)
local o = {
num=i;

}

setmetatable(o,self)
return o;
end[/lua] [import]uid: 138547 topic_id: 25528 reply_id: 103233[/import]