I'm getting a crash that I can't diagnose... I found some workarounds but I want to understand what's going on. To reproduce:
* Run attached .love
* You control the big love symbol ("the hero") at the bottom
* There are weird-looking robots zooming past.
* Click the LMB to explode the robots. Note that they spawn "pieces" of themselves when they die. Hero can collect these pieces.
* You don't need to use the mouse any more.
* Instead, use the arrow keys to move the hero. Try to crash into the weird-looking robots.
* If you crash such that the hero collects all the spawned pieces at once, CRASH! I try to have a head on collision to get it reliably.
* It's _very_ easy to get the crash. 5 seconds usually.
The crash symptom is either:
1) Love locks up. Have to terminate process via Task Manager
2) Crash. App window just disappears.
StdError (when I get it) is:
Code: Select all
attempt to call a number value stack traceback: [C]: in function 'update' [string "main.lua"]:182: in function <[string "main.lua"]:141>
I can reduce and maybe even eliminate the crash by spawning less pieces. In trashbot:collision(a,b,c) I can comment out piece:new() calls one by one, so that a robot spawns only one or two pieces. Then the crash becomes at least very rare. Simply exploding the robots (using LMB) or collecting the pieces with the hero is fine. It's when there's a hero/trashbot collision, and I'm wondering if trying to create/delete something out of order. I can't see it.
So I'm kind of poking at the problem, but I don't actually understand why it's crashing. Can anyone help?