语法错误“'='预计在'_APPNAME附近'没有意义

时间:2017-09-27 00:37:42

标签: lua syntax-error corona

这是我的代码:

main.lua:

-- start the app, declare some variables, setup the player save file. 

-- APP OPTIONS
_APPNAME = "The Square Cannon"
_FONT = "Tolo"

--  OTHER UPGRADES

_SHOWADS = TRUE

-- CONSTANT VALUES
_CX = display.contentWidth*0.5 --center of the screeen going horizontally
_CY = display.contentHeight*0.5 --center of the screem going vertically
_CW = display.contentWidth -- width of the screen
_CH = display.contentHeight -- height of the screen
_T = display.screenOriginY -- top of the screen
_L = display.screenOriginX -- left of the screen
_R = display.viewableContentWidth - _L -- right of the screen
_B = display.viewableContentHeight - _T -- bottom of the screen

-- hide the status bar
display.setStatusBar( display.HiddenStatusBar )

-- include composer
local composer = require "composer"

-- include load/save library from coronarob
loadsave = require("loadsave")

-- load some audio
_BACKGROUNDMUSIC = audio.loadStream("THESQUARECANNON\audio\IceFLow" , "THESQUARECANNON\audio\FreeInstrumental")
--{
    --load some sound effects, when created
--}

-- set up a saved file for our user
user = loadsave.loadTable("user.json")
if (user == nil) then
    user = {}
    user.playsound = true
    loadsave.saveTable(user, "user.json")
end

composer.gotoScene("scene_menu")

这是我得到的错误:

main.lua:5: '=' expected near "'_APPNAME'"

可能出现什么问题?虽然控制台仍然说我需要一个=符号,但我确实有一个guess符号。

2 个答案:

答案 0 :(得分:0)

你有没有显示的代码吗?我算了3个左括号和2个右括号。 你有另一个错字。

_CX = display.contentWIdth*0.5 -

应该是

_CX = display.contentWidth*0.5 -

答案 1 :(得分:0)

该错误消息是由于文件中存在config.lua

config.lua更改为-- config.lua会给您一个不同的消息,因为括号不平衡。