Currently, I am working on pre-collision for one-way platforms. I am pleased with the result but occasionally I get this error:
ERROR: Runtime error characterfunctions.lua:216: attempt to index local 'contact' (a nil value) stack traceback: characterfunctions.lua:216: in function '?' ?: in function \<?:190\>
I am not sure what’s causing it, and how to isolate it, but here’s the code:
local contact = event.contact -- Line 212 local other = event.other if( other.isFloating ) then if( contact.isEnabled and self.y \> other.y - other.height / 2) then contact.isEnabled = false end end -- Line 219
The error is the first line in the first if statement of this code.
Any help would be greatly appreciated, thanks!