Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

unexpected symbol near '.'
Started by jay0422 Dec 18 2013 06:49 PM

- - - - -
7 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

jay0422

[GLOBAL: userInfoPane.html]
jay0422
  • Observer

  • 2 posts
  • Corona SDK

Sorry If I posted on the wrong section or if this has been solved before but my problem is;

My Code keeps saying unexpected symbol near '.' and I have no idea what the problem is

 

a screeny of the error

T6J7FQj.png

 

Settings Code

Spoiler

 

Main Menu Code]

Spoiler
 
And If anyone could help me with the "gotoScene" error that would be great! :D
 


[TOPIC: post.html]
#2

ingemar

[GLOBAL: userInfoPane.html]
ingemar
  • Corona Geek

  • 2,733 posts
  • Enterprise

One thing I see in your Settings.lua is that the code from "local backgroundImage = ..." all the way to "group:insert(backButton)" is outside the createScene function.



[TOPIC: post.html]
#3

ufuk_koc91

[GLOBAL: userInfoPane.html]
ufuk_koc91
  • Observer

  • 5 posts
  • Corona SDK

Hello I have similar problem and I don't know what to do, first problem was about "graphicsCompatibilty" I added a file "config.lua" inclueded this code: graphicsCompatibility = 1,
Now it exist that problem:

 

 

error loading module 'start' from file
'c'\users......\start.lua4: unexpected 
symbol near 'local'
stach traceback:
[C]:?
[C]:in function 'gotoScene'
c:\.......\main.lua:5: in main 
chunk

do you want to relaunch the project?
 

I hope someone can tell me how can I fix that.

Thanks



[TOPIC: post.html]
#4

ufuk_koc91

[GLOBAL: userInfoPane.html]
ufuk_koc91
  • Observer

  • 5 posts
  • Corona SDK

[TOPIC: post.html]
#5

Burhan J

[GLOBAL: userInfoPane.html]
Burhan J
  • Contributor

  • 131 posts
  • Corona SDK

Hi @ufuk_koc91,

 

I did not get your error. What corona version are you using?

 

But it shows other error which is related to sprite usage.

The code uses sprite which have since been deprecated.

 

You can either re-code to the new display.newSprite 

or

you can download the sprite library (no longer supported) which coronalab upload to github. 

 

https://github.com/coronalabs/framework-sprite-legacy

 

 

if you choose the second option then you need to place the sprite.lua into the root folder and

do some editing to your game.lua

 

change

 

 

--require "sprite"
 
to
 
local sprite = require("sprite")
 
 
It works on my corona mac version 2100.
 
Good luck!
 
burhan


[TOPIC: post.html]
#6

ufuk_koc91

[GLOBAL: userInfoPane.html]
ufuk_koc91
  • Observer

  • 5 posts
  • Corona SDK

Hello Burhan!
Thank you so much for your reply!

now it runs!

 

I am new at proggramming and in Corona, I m trying to learn from tutorials, but mostly  I have problem, I download files of tutorials, when I run them, mostly it gives error.
Check this please:

 

first problem was about graphicsCompatibility, I fixed but later it gives this error:
http://oi61.tinypic.com/2yl3ede.jpg

 

Why all these happen? I am usuing windows 7 and CoronaSDK-2013.2100, these problems exist because of I use corona for windows and the files I want to use made in Mac?
what should I do? should I buy Corona Basic or Pro or should I have got Macbook?



[TOPIC: post.html]
#7

jgarcia6790

[GLOBAL: userInfoPane.html]
jgarcia6790
  • Observer

  • 1 posts
  • Corona SDK

im having an issue trying to figure this problem out.. for some reason I am getting a main.lua:1: unexpected symbol near '?'  which falls on the first line "require("physics")..  but I was following the step by step from a guy on youtube to create this game. I have been searching and I cannot see any errors. what seems to be the problem??

 

 

require ("physics")

 

 function main()
    setUpPhysics()
  createWalls()
  createBricks()
  createBall()
  createPaddle()
  startGame()
 
 
 end
 
 
 function setUpPhysics()
 physics.start()
  --physics.setDrawMode("hybrid")
  physics.setGravity(0,0)
 end
 
 
 
 
 function createPaddle()
  
  local paddleWidth = 100
  local paddleHeight = 10
  
  local paddle = display.newRect( display.contentWidth / 2 - paddleWidth / 2, display.contentHeight - 50, paddleWidth, paddleHeight )
  physics.addBody(paddle, "static", {friction=0, bounce=1})
 
 
  local  movePaddle = function(event)
    paddle.x = event.x
  end
 
 
  Runtime:addEventListener("touch", movePaddle)
  
 end
 
 
 
 
 function createBall()
 
 
  local ballRadius = 10
 
 
  ball = display.newCircle( display.contentWidth / 2, display.contentHeight / 2, ballRadius )
  physics.addBody(ball, "dynamic", {friction=0, bounce = 1, radius=ballRadius})
 
 
  ball.collision = function(self, event)
   if(event.phase == "ended") then
    
    if(event.other.type == "destructible") then
     event.other:removeSelf()
    end
    
    if(event.other.type == "bottomWall") then
    
     self:removeSelf()
     
     local onTimerComplete = function(event)
      createBall()
      startGame()
     end
     
     timer.performWithDelay(500, onTimerComplete , 1)
    end
   end
  end
 
 
  ball:addEventListener("collision", ball)
 end
 
 
 function startGame()
  ball:setLinearVelocity(75, 150) 
 end
 
 
 
 function createBricks()
  
  local brickWidth = 40
  local brickHeight = 20
   
  local numOfRows = 4
  local numOfCols = 6
  
  local topLeft = {x= display.contentWidth / 2 - (brickWidth * numOfCols ) / 2, y= 50}
  
  local row
  local col
  
  for row = 0, numOfRows - 1 do
   for col = 0, numOfCols - 1 do
   
    -- Create a brick
    local brick = display.newRect( topLeft.x + (col * brickWidth), topLeft.y + (row * brickHeight), brickWidth, brickHeight )
    brick:setFillColor(math.random(50, 255), math.random(50, 255), math.random(50, 255), 255)
    brick.type = "destructible"
    
    physics.addBody(brick, "static", {friction=0, bounce = 1})
   end
  end
 end
 
 
 
 
 function createWalls()
  
  local wallThickness = 10
  
  -- Left wall
  local wall = display.newRect( 0, 0, wallThickness, display.contentHeight )
  physics.addBody(wall, "static", {friction=0, bounce = 1})
  
 -- Top wall
  wall = display.newRect(0,0, display.contentWidth, wallThickness)
  physics.addBody(wall, "static", {friction=0, bounce = 1})
  
  -- Right wall
  wall = display.newRect(display.contentWidth - wallThickness, 0, wallThickness, display.contentHeight)
  physics.addBody(wall, "static", {friction=0, bounce = 1})
  
  -- Bottom wall
  wall = display.newRect(0, display.contentHeight - wallThickness, display.contentWidth, wallThickness)
  physics.addBody(wall, "static", {friction=0, bounce = 1})
  
  wall.type = "bottomWall"
 end
 
main()



[TOPIC: post.html]
#8

bjsorrentino

[GLOBAL: userInfoPane.html]
bjsorrentino
  • Veteran

  • 8,506 posts
  • Corona SDK

Hi @jgarcia6790,

You need to set the require to a variable, like this:

 

local physics = require( "physics" )

 

Take care,

Brent




[topic_controls]
[/topic_controls]