I am new to LOVE and Lua, and am in the process of trying to make a basic pong game to learn more and improve my skills. I have found myself stuck with a recent issue, however. My file is attached and you can see the whole thing at https://pastebin.com/APd0FuVz. The specific functions are below:
function room:update(dt)
for i = #self.game_objects, 1, -1 do
active_object = self.game_objects[i]
active_object:update(dt)
if self.detectOutOfBounds(active_object) then active_object:collision() end
end
end
function room:detectOutOfBounds(active_object)
local aw, ah = active_object:getSize()
return active_object.x > (love.graphics.getWidth() + aw) and
active_object.y > (love.graphics.getHeight() + ah) and
active_object.x < 0 and
active_object.y < 0
end
My current issue is that in the function "detectOutOfBounds" the first line returns the error that "active_object" is nil. I have been stuck on this as it appears to have value when checked in the "update" function just before "detectOutOfBounds" is called. I suspect that the issue is something really simple, but I would greatly appreciate any help or advice you could offer!