Help me… where is the error!!
error: main.lua:42:attempt to index local ‘hits’ (a nil value)
display.setStatusBar( display.HiddenStatusBar ) W= display.contentWidth H= display.contentHeight local physics = require ("physics") physics.start() local sX = 284 local sY = 1024 local eX = 484 local eY = 1024 local bg = display.newImage("bg.png") bg:scale( 1.4,1.4 ) local circle = display.newCircle(W/2,H/2-500,100) circle:setFillColor(0,0,0) physics.addBody(circle,{bounce = 0.5,radius= 100}) local ground = display.newRect(0,1024,284,10) ground:setFillColor(0,0,0) physics.addBody(ground,"static",{}) local ground1 = display.newRect(484,1024,284,10) ground1:setFillColor(0,0,0) physics.addBody(ground1,"static",{}) local function checkForHit(object, from\_x, from\_y, to\_x, to\_y) local hits = physics.rayCast( from\_x, from\_y, to\_x, to\_y ) if hits[1].object == circle then print ("hit") end end Runtime:addEventListener( "enterFrame", function() checkForHit(circle, sX, sY, eX, eY )end )