This is part of my game.lua I keep getting this error though.
function scene:createScene(event)
end
screenGroup = self.view
background = display.newImage("Space-Background-Image.gif")
screenGroup:insert(background)
local background1 = display.newImage("Space-Background-Image.gif")
background.x = 90
screenGroup:insert(background1)
function scrollBackground(self,event)
if self.x < -480 then
self.x = 480
else
self.x = self.x - 3
end
end
There are two ways to call functions in lua
1) call the function with ':' gives 'm' as first argument
m:DoJob()
2) but if you call if with '.' you have to define the context where to look for the function, typically the module itself
m.DoJob(m)
If you call a method defined in the module as
module:Method()
withmodule.Method()
it expects as argument self and throws an error.It appears to me that you've misplaced the closing
end
in yourcreateScene
method. Try moving the lines below into the function body so the implicitself
is used instead of the globalself
key: