I'm using Corona's physics engine and running into a problem. When a collision occurs, self and event are nil, even though they have a table value (my understanding is that tables can hold any value except nil).
function onCollision(self,event)
print(event); -- output -> table: 097EF680
print(self); -- output -> table: 098349D0
if (event.phase == "began") then
print(self.myName .. ": collision began with " .. event.other.myName)
end
end
The if statement should print which two objects are colliding, however I get the error
...\main.lua:270: attempt to concatenate field 'myName' (a nil value)
which is what lead me to add the print statements. The collision IS being detected since this error only happens on a collision, and those two values SHOULD exist since they have an ID. But attempting to access them (through event.myName, event[1]) returns a nil value.
myName is of course defined and not nil for the two objects that are colliding.