这是我的代码:
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
符号。
答案 0 :(得分:0)
你有没有显示的代码吗?我算了3个左括号和2个右括号。 你有另一个错字。
_CX = display.contentWIdth*0.5 -
应该是
_CX = display.contentWidth*0.5 -
答案 1 :(得分:0)
该错误消息是由于文件中存在config.lua
。
将config.lua
更改为-- config.lua
会给您一个不同的消息,因为括号不平衡。