mobile gives error simulator does not

i have an app in development, and i tried testing it on my mobile device where it gives an error that the simulator did not.
the error is
Runtime Error

scene1.lua:293:attempt to index upvalue ‘background’ (a nil value)

if refers to this function.
i’ve been looking through it a few times and cannot seem to find the problem.

anyone that can see what im missing?

function background:touch( event ) local result = true local phase = event.phase local previousTouches = self.previousTouches local numTotalTouches = 1 if ( previousTouches ) then numTotalTouches = numTotalTouches + self.numPreviousTouches if previousTouches[event.id] then numTotalTouches = numTotalTouches - 1 end end if "began" == phase then if ( not self.isFocus ) then display.getCurrentStage():setFocus( self ) self.isFocus = true previousTouches = {} self.previousTouches = previousTouches self.numPreviousTouches = 0 elseif ( not self.distance ) then local dx,dy if previousTouches and ( numTotalTouches ) \>= 2 then dx,dy = calculateDelta( previousTouches, event ) end if ( dx and dy ) then local d = math.sqrt( dx\*dx + dy\*dy ) if ( d \> 0 ) then self.distance = d self.xScaleOriginal = self.xScale self.yScaleOriginal = self.yScale print( "distance = " .. self.distance ) end end end if not previousTouches[event.id] then self.numPreviousTouches = self.numPreviousTouches + 1 end previousTouches[event.id] = event elseif self.isFocus then if "moved" == phase then if ( self.distance ) then local dx,dy if previousTouches and ( numTotalTouches ) \>= 2 then dx,dy = calculateDelta( previousTouches, event ) end if ( dx and dy ) then local newDistance = math.sqrt( dx\*dx + dy\*dy ) local scale = newDistance / self.distance print( "newDistance(" ..newDistance .. ") / distance(" .. self.distance .. ") = scale(".. scale ..")" ) if ( scale \> 0 ) then self.xScale = self.xScaleOriginal \* scale self.yScale = self.yScaleOriginal \* scale scalemax() end end end if not previousTouches[event.id] then self.numPreviousTouches = self.numPreviousTouches + 1 end previousTouches[event.id] = event elseif "ended" == phase or "cancelled" == phase then if previousTouches[event.id] then self.numPreviousTouches = self.numPreviousTouches - 1 previousTouches[event.id] = nil end if ( #previousTouches \> 0 ) then self.distance = nil else display.getCurrentStage():setFocus( nil ) self.isFocus = false self.distance = nil self.xScaleOriginal = nil self.yScaleOriginal = nil self.previousTouches = nil self.numPreviousTouches = nil end end end return result end

if needed i can share the whole project.

Edit: it has worked on earlier builds but even trying to remove the things i added gives me the same error

solved it, found out my partner had renamed the file used for the background. and made it a K instead of k

solved it, found out my partner had renamed the file used for the background. and made it a K instead of k