-
-
Save Lintzmaia/ad2b7527a5c90c6246e75f93df37f9ea to your computer and use it in GitHub Desktop.
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
local nk = require("nakama") | |
local function ReadObjectEncode(context, payload) | |
local user_id = "removed-for-sharing-on-gist" -- some user ID. | |
local json = nk.json_decode(payload) | |
local object_ids = { | |
{collection = json.collection, key = json.key, user_id = user_id} | |
} | |
local objects = nk.storage_read(object_ids) | |
for _, r in ipairs(objects) | |
do | |
return nk.json_encode(r.value) | |
end | |
return "Wrong collection/key" | |
end | |
nk.register_rpc(ReadObjectEncode, "read_object_encode") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment