I've got a super-clean bug report for a demo that runs on Playdate but crashes the playdate if run through pulpmill. It seems to indicate that, in this program, "crop" is causing a system crash when run through pulpmill.
It only has 134 lines of code, all in player (embedded below), except that the game script also sets crop to 7.5, 2.5, 9, 9.
Running the pulpmilled game causes the playdate/simulator to crash, with error:
Update error: pulp.lua:1127: attempt to index a nil value (field '?')
stack traceback:
pulp.lua:1127: in function <pulp.lua:991>
which correspond to:
for x = cropl,cropr do
for y = cropu,cropd do
local tilei = roomtiles[y][x]
and
function playdate.update()
respectively.
Clearing the Game script (which basically only contained crop) caused pulpmill to run normally. The pulp .jsons and compiled outputs of the broken and fixed versions are attached.
Full code:
Full pulpscript of game except Game script: Player
on draw do
if rick==1 then
initx = 9
initx -= shiftleft
inity = 4
call "drawrick"
initx = 15
inity = 4
initx -= shiftleft
draw "white" at initx,inity
log "drawing player at x,{inity}"
inity++
log "drawing player at x,{inity}"
draw "white" at initx,inity
inity++
log "drawing player at x,{inity}"
draw "white" at initx,inity
inity++
log "drawing player at x,{inity}"
draw "white" at initx,inity
inity++
log "drawing player at x,{inity}"
draw "white" at initx,inity
inity++
log "drawing player at x,{inity}"
draw "white" at initx,inity
initx = 16
inity = 4
initx -= shiftleft
call "drawrick"
if shiftleft>=7 then
shiftleft = 0
else
shiftleft += 0.125
end
else
initx = 9
inity = 4
call "drawrick"
end
fill "black" at 4,32,64,48
fill "black" at 124,32,64,48
end
on drawrick do
draw "Rick 1" at initx,inity
initx++
draw "Rick 2" at initx,inity
initx++
draw "Rick 3" at initx,inity
initx++
draw "Rick 4" at initx,inity
initx++
draw "Rick 5" at initx,inity
initx++
draw "Rick 6" at initx,inity
initx -= 5
inity++
draw "Rick 7" at initx,inity
initx++
draw "Rick 8" at initx,inity
initx++
draw "Rick 9" at initx,inity
initx++
draw "Rick 10" at initx,inity
initx++
draw "Rick 11" at initx,inity
initx++
draw "Rick 12" at initx,inity
initx -= 5
inity++
draw "Rick 13" at initx,inity
initx++
draw "Rick 14" at initx,inity
initx++
draw "Rick 15" at initx,inity
initx++
draw "Rick 16" at initx,inity
initx++
draw "Rick 17" at initx,inity
initx++
draw "Rick 18" at initx,inity
initx -= 5
inity++
draw "Rick 19" at initx,inity
initx++
draw "Rick 20" at initx,inity
initx++
draw "Rick 21" at initx,inity
initx++
draw "Rick 22" at initx,inity
initx++
draw "Rick 23" at initx,inity
initx++
draw "Rick 24" at initx,inity
initx -= 5
inity++
draw "Rick 25" at initx,inity
initx++
draw "Rick 26" at initx,inity
initx++
draw "Rick 27" at initx,inity
initx++
draw "Rick 28" at initx,inity
initx++
draw "Rick 29" at initx,inity
initx++
draw "Rick 30" at initx,inity
initx -= 5
inity++
draw "Rick 31" at initx,inity
initx++
draw "Rick 32" at initx,inity
initx++
draw "Rick 33" at initx,inity
initx++
draw "Rick 34" at initx,inity
initx++
draw "Rick 35" at initx,inity
initx++
draw "Rick 36" at initx,inity
end
on confirm do
if rick==0 then
rick = 1
else
rick = 0
end
log "rick={rick}"
end
'Game' pulpscript which needed to be removed
on load do
cropx = 7.5
cropy = 2.5
crop to cropx,cropy,9,9
restore
if hasPlayed==1 then
log "welcome back!"
else
log "nice to meet you."
end
hasPlayed = 1
store "hasPlayed"
end
on finish do
log "who are you again?"
// toss
end
Starv-broken and fixed.zip (75.9 KB)