Sdk 更新解析列
我是解析新手,我的parse.com表中名为User的score列有问题 这里有我的登录功能,在用户成功登录后,我有这个功能,应该在用户玩游戏时更新分数Sdk 更新解析列,sdk,lua,parse-platform,coronasdk,Sdk,Lua,Parse Platform,Coronasdk,我是解析新手,我的parse.com表中名为User的score列有问题 这里有我的登录功能,在用户成功登录后,我有这个功能,应该在用户玩游戏时更新分数 local parse = require( "mod_parse" ) local ego = require "ego" local saveFile = ego.saveFile local loadFile = ego.loadFile --------------------------------------------------
local parse = require( "mod_parse" )
local ego = require "ego"
local saveFile = ego.saveFile
local loadFile = ego.loadFile
--------------------------------------------------------------------
--------------------------------------------------------------------
_G.score = 1
_G.highscore = loadFile ("highscores.txt")
local function checkForFile ()
if highscore == "empty" then
highscore = 0
saveFile("highscores.txt", highscore)
end
end
checkForFile()
--Print the current highscore
print ("Highscore is", highscore)
-----------------------------------------------
dataTable = { ["score"] = tonumber(highscore) }
function onSystemEvent (event)
if _G.score > tonumber(_G.highscore) then --We use tonumber as highscore is a string when loaded
saveFile("highscores.txt", _G.score)
parse:updateObject( "objectId", dataTable, onSystemEvent )
end
end
_G.timer1=timer.performWithDelay(100, addToScore, 0)
这些函数将得分
与高分进行比较,如果得分高于高分
则用新值更新高分
我在使用
parse:updateObject
函数时遇到问题。我在解析中有一个名为score
的列,我正试图用新的高分更新它。我做错了什么?您试图通过调用updateObject方法来保存对象,我认为这需要您知道要保存的对象的objectID。我猜您试图使用“objectId”,但这肯定不是正确的objectId。除此之外,我不能帮助你,因为我不认识卢阿
我猜您需要某种类型的ParseObject来保存新行