Player as a Table to animate

macOS SDK 2.0.1

I am trying to upgrade my player to a table so I can animate a walk cycle the file is called
player-R-table-192-32.png

this is the code I am editing but I am still confused as to how to do this and at the moment my assert fails

function Player:updateImage(direction)
    -- local playerImage = gfx.image.new("images/sprites/player/player-" .. self.direction)
    -- self:setImage(playerImage)
    local playerTable = gfx.imagetable.new("images/sprites/player/player-" .. self.direction)
    assert(self.playerTable)
    self.playerImage = gfx.tilemap.new()
    self.playerImage:setImageTable(self.playerTable)
    self.playerTable:setSize(32, 32)
    self.playerSprite = gfx.sprite.new()
    self.playerSprite:setTilemap(self.playerImage)
    self.playerSprite:add()
end

You're asserting self.playerTable but on the previous line define just playerTable

Also, it might be easier to use this: Lightweight AnimatedImage Library to achieve your goal.

oh yeah !

ok cool no errors now but no sprite showing

function Player:updateImage(direction)
    local playerTable = gfx.imagetable.new("images/sprites/player/player-" .. self.direction)
    assert(playerTable)
    self.playerImage = gfx.tilemap.new()
    self.playerImage:setImageTable(playerTable)
    self.playerImage:setSize(32, 32)
    self.playerSprite = gfx.sprite.new()
    self.playerSprite:setTilemap(self.playerImage)
    self.playerSprite:add()
end