Pac-Man effect: doesn't happen... self.x or sprite.x?

Hello everybody
I'm relativly new here and in programming expecially with LUA. I'm trying to implement the Pac-Man effect, very easy, but, even if I think everything is good, nothing happen. I think that there is some confusion between "self.x" and "aereoSpirte.x".
Here the main:

import "coreLibs/graphics"
import "coreLibs/sprites"
import "coreLibs/timer"
import "coreLibs/object"
import "coreLibs/easing"
import "coreLibs/crank"

import "aereo"


local pd <const> = playdate
local gfx <const> = pd.graphics

Aereo(200, 120) 

local giocoVa = true

function pd.update()
    if giocoVa == true then
        gfx.sprite.update()
        pd.timer.updateTimers()
    end
end

and here the object Aereo:

local pd <const> = playdate
local gfx <const> = pd.graphics


class('Aereo').extends(gfx.sprite)

function Aereo:init(x, y)
    local aereoImage = gfx.image.new("images/aereo")
    aereoSprite = gfx.sprite.new(aereoImage)
    self:setImage(aereoImage)
    self:moveTo(x, y)

    self:add()

    self.speed = 2
end

function Aereo:update()
    local crankAngle = pd.getCrankPosition()
	self:moveBy(math.sin(math.rad(crankAngle)) * self.speed, 0)
	self:moveBy(0, -math.cos(math.rad(crankAngle)) * self.speed)
    self:setRotation(crankAngle)

    self:pacman()
end

function Aereo:pacman()
    if self.x > 400 then
        self.x = 0
    elseif self.x < 0 then
        self.x = 400
    end
end

There are no errors, I just think there is no "memorization" of the coordinates.

Sorry for my bad English.

playdate.graphics.sprite.x (among others) are meant to be read-only so lines like self.x = 0 won't do anything. Try using something like self:moveTo(0, self.y) instead to move the sprite to the other side.

It's true!!!!

function Aereo:pacman()
    if self.x > 415 then
        self:moveTo(-15, self.y)
    end
    if self.x < -15 then
        self:moveTo(415, self.y)
    end
    if self.y > 255 then
        self:moveTo(self.x, -15)
    end
    if self.y < -15 then
        self:moveTo(self.x, 25)
    end
end

I have add this, and now it works.
TNX