Created
April 23, 2018 13:57
-
-
Save madclaws/2a812b50f085acf3bdd901451d893cd0 to your computer and use it in GitHub Desktop.
storing playerdata
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function helper.writePlayerData(_playerID,_color) | |
-- local curCount | |
local curCount=fetchCount() | |
print(curCount.current) | |
print(_playerID .. " : " .. _color) | |
local new_record={ | |
{Bucket=_bucket,Collection="GamePlay",Record="playerData",Value={id=curCount.current,color=_color}} | |
} | |
if curCount.current<1 then | |
nk.storage_write(new_record) | |
else | |
local updateOps={ | |
{Op="append",Path="/",Value={id=curCount.current,color=_color}} | |
} | |
local updateRecord={ | |
{Bucket=_bucket,Collection="GamePlay",Record="playerData",Update=updateOps} | |
} | |
nk.storage_update(updateRecord) | |
end | |
updateCount(curCount.current) | |
fetchPlayerData(_playerID) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment