Little problem...

Hello i have little problem, and i don’t know how to fix this error…

-> main.lua:34: ‘=’ expected near 'local’

there are propably more errors

thanks to everyone who will help me with it.

[lua]— Made by wites, just test project–

local widget = require(“widget”)

display.setStatusBar(display.HiddenStatusBar)
local physics = require “physics”
physics.start()
physics.setGravity(0,0)
local tlo = display.newImage( “tlo.png” )

– position the image
tlo:translate( 100, 240 )
centerX = display.contentCenterX
centerY = display.contentCenterY
screenLeft = display.screenOriginX
screenWidth = display.contentWidth - screenLeft * 2
screenRight = screenLeft + screenWidth
screenTop = display.screenOriginY
screenHeight = display.contentHeight - screenTop * 2
screenBottom = screenTop + screenHeight
display.contentWidth = screenWidth
display.contentHeight = screenHeight
– ustawienia tla
tlo.x = centerX
tlo.y = centerY
tlo.width = screenWidth
tlo.height = screenHeight
tlo.isVisible = true

– funkcje –
local functions buttonTapped(event)
    local id event.target.id
local function doButtons()

    local optButton = widget.newButton { label=“Set Options”, onRelase=buttonTapped }
    optButton.x = centerX
    optButton.y = centerY
    
end
doButtons()
–doScroll()

function touchScreen(event)
    if event.phase == “ended” then
        transition.to(ball,{time=750, x=event.x, y=event.y})    
    end
end

function movebadball()
    transition.to(badball,{time=1000, x=math.random(80,600), y=math.random(60,480), onComplete=movebadball})
    end
movebadball()

function onCollision(event)
    --print(“collide!”)
    ball:removeSelf()
end

local ball = display.newImage(“ball.png”)
ball.x = 40
ball.y = 50
physics.addBody(ball, “dynamic”)

local badball = display.newImage(“badball.png”)
badball.x = 260
badball.y = 400
physics.addBody(badball, “static”)

Runtime:addEventListener(“touch”, touchScreen)

Runtime:addEventListener(“collision”, onCollision)[/lua]

Hi @wites,

This looks like a basic syntax error. Most likely you did not close a function with an “end” in the proper place.

Proper indentation is essential when coding… if you are not using a text editor which helps you with indentation, I suggest that you do so.

Take care,

Brent

Like Brent said, you’ve got a problem with your function placement. On line 27-28, you have what looks like some “junk code” (“local functions” instead of “local function”, just some variables sitting out doing nothing). Consider completing it or deleting it.

Also, just to keep you from bugs in the future, on line #30, you’ve accidentally written “onRelase” rather than “onRelease”.

  • Caleb

Thank you very much guys!

Hi @wites,

This looks like a basic syntax error. Most likely you did not close a function with an “end” in the proper place.

Proper indentation is essential when coding… if you are not using a text editor which helps you with indentation, I suggest that you do so.

Take care,

Brent

Like Brent said, you’ve got a problem with your function placement. On line 27-28, you have what looks like some “junk code” (“local functions” instead of “local function”, just some variables sitting out doing nothing). Consider completing it or deleting it.

Also, just to keep you from bugs in the future, on line #30, you’ve accidentally written “onRelase” rather than “onRelease”.

  • Caleb

Thank you very much guys!