0
我有一個函數,它將變量從原來的變成了新的東西。我正在使用load-save .json表來獲取和加載數據。如何更新startmoneyTxt以顯示新變量?如何更新corona SDK中的變量?
我的功能:
local function unlockBall(event)
ballfirst = loadsave.loadTable("firstBall.json", system.DocumentsDirectory)
currentMoney1 = loadsave.loadTable("cashTable.json", system.DocumentsDirectory)
difference = currentMoney1 - ballfirstUnlock
if(ballfirst == 0 and difference >= 0)then
ballfirstID = 1
loadsave.saveTable(ballfirstID, "firstBall.json", system.DocumentsDirectory)
loadsave.saveTable(difference, "cashTable.json", system.DocumentsDirectory)
end
end
我的代碼應該被更新:
currentMoney = loadsave.loadTable("cashTable.json", system.DocumentsDirectory)
startmoneyTxt= display.newText("$ "..currentMoney.." " , 0,0, "Helvetica", 20)
sceneGroup:insert(startmoneyTxt)