Sprite doesn't have a lua proxy! [Mac and Windows]

,

I'm constantly getting this bug, Sprite doesn't have a lua proxy!. It says it's caused by the moveWithCollisions method on line 24.
I've run into this bug before, that time I was able to fix it by moving where I handled the garbage collection but that's not the case this time.

This is my bullet class, it says the error pops up on line 24, where the moveWithCollisions method is. I've already tried adding in some checks to avoid calling after it's been destroyed but it's not helping.

local gfx <const> = playdate.graphics

class("Bullet").extends(Actor)

function Bullet:init(x, y, dx, dy)
  Bullet.super.init(self)

  self:setGroups({Group.bullet})
  self:setCollidesWithGroups({Group.solid})
  self:setZIndex(ZIndex.bullet)
  self:setImage(_image_bullet)
  self:setCollideRect(0,0, self:getSize())
  self:moveTo(x, y)
  self._to_destroy = false

  self.dx = dx * 250 * deltaTime
  self.dy = dy * 250 * deltaTime
end

function Bullet:update()
  if self._to_destroy then
    self:destroy()
  else
    self:moveWithCollisions(self.x+self.dx, self.y+self.dy)
  end
end

function Bullet:collisionResponse(other)
  if self._to_destroy then return end
  self:setVisible(false)
  self:setCollisionsEnabled(false)
  self._to_destroy = true
end

I'll also say, I've only been able to reproduce this bug on device, not on the simulator.
I'm on the latest SDK, and my device is up to date.

Hi! I don't seem to be able to reproduce what you're seeing based on that code snippet alone. There are a few things I am wondering about, like what happens in the Bullet:destroy() function?

If you have an example project that demonstrates the problem, that would be extremely helpful!

I'll attach my little project that was a failed attempt to recreate the problem:

SpriteTestGame.zip (28.4 KB)

the Actor class is just a very thin wrapper around sprite, mostly because I prefer calling things Actors :person_shrugging:

local gfx <const> = pd.graphics

class("Actor").extends(gfx.sprite)


function Actor:init()
	Actor.super.init(self)
	self:add()
end

function Actor:destroy()
	self:remove()
end

pet_sematary.pdx.zip (66.7 KB)

Here's the current version, just hold down shoot and move around. It'll crash soon enough.

Did you ever figure this out? I'm getting this as well, but can't seem to track down why.