我正在尝试保存我的高分,但我看到错误文件错误:C:\ Users \ romlu \ AppData \ Local \ Corona Labs \ Corona Simulator \ Sandbox \ stand out-5004F908333A8F9EE4A9B4F8532E8EA1 \ Documents \ highscore.json:无此类文件文件或目录
我只是打开文件并尝试在其中写入信息并读取内容,但我看到此错误。请帮助我。
这是我的代码的一部分。
local sceneGroup = self.view
-- Code here runs when the scene is first created but has not yet appeared on screen
local path = system.pathForFile( "highscore.json", system.ResourceDirectory)
local file = io.open( path, "r" )
local contents = file:read( "*n" )
local textHighscore = display.newText(string.format("Highscore: %d", contents), display.contentCenterX, display.contentHeight - 50, native.systemFont, 25)
textHighscore:setFillColor(255, 0, 0)
sceneGroup:insert(textHighscore)
io.close( file )