Single File Examples "perlin-distribution" crash

Platform: Mac OS 12.0.1 (M1 Silicon)


While running a fresh "perlin-distribution" example, a repeatable crash occurs:

  • When the persistence value is changed "-0.09999999"
  • When the octaves is changed from or to "3"
  • When in the (x,y,z) distribution view

It can be difficult to precisely reproduce sometimes, but playing around with moving through octaves and persistences, it will happen after a few seconds of fiddling about. Provides this error:

perlin-distribution.lua:34: attempt to perform arithmetic on a nil value (field '?')
stack traceback:
	perlin-distribution.lua:34: in function <perlin-distribution.lua:19>

Not a huge deal, but wanted to expose it to help the cause!

Thank you,

1 Like

I'm seeing this same crash on an actual Playdate with a game I made with Pulp. It works in the simulator, but always crashes on device.

In the Player script:

on crank do
	// get angle between 0 - 180:
	if event.ra<0 then
		direction = "backwards"
		direction = "forwards"
	if direction!=last_direction then
		total_cranked = 0
	total_cranked += event.ra
	last_direction = direction
	call "updateJuicer" // Calculates x,y for item and calls `updateFrame`

and in my item script

on updateFrame do
	juiceLvl = total_cranked
	juiceLvl /= 360
	log "Juice lvl: {juiceLvl}"
	juiceFrame = floor juiceLvl
	frame juiceFrame
	if juiceFrame>=4 then
		total_cranked = 0
		hasJuice = 1

Edit / Fix: It turns out this error was being thrown because I was setting an invalid frame of a tile. I added an extra frame and the error stopped.