Hello everybody!
Im starting working with Nakama and currently trying to understand some things.
Im using Lua for language, and trying to get some stuff working.
In the API explorer I seems to not being able to store objects with a non empty value
{
"objects": [
{
"collection": "inventory",
"key": "weapons",
"value": "{}",
"version": "",
"permissionRead": 1,
"permissionWrite": 1
}
]
}
I did tryied to put anything in value and I always got the rpc error: code = InvalidArgument desc = Value must be a JSON object.
, the only way im not getting that error its while using empty value which is ofc not how to use the storage engine
Same happens if I try to run a similar code from my inventory.lua script.
Full code here.
local nk = require("nakama")
nk.logger_info("Economy module loaded")
function EditInventory_rpc(context, payload)
nk.logger_info("Inventory Manager Loaded")
local version = nil
local new_objects = {
{ collection = "inventory", key = "weapons", user_id = "00000000-0000-0000-0000-000000000000", value = {}, version = "", permission_read = 1, permission_write = 1 }
}
nk.storage_write(new_objects)
end
Where am I failing? What is expected to be inside of version? Can someone show me a complete example of a storage write with version filled up?
Edit: Im also having an “Error whilst making RPC call: SyntaxError: Unexpected end of JSON input” in the API Explorer using my custom function, but it stills write to the inventory. Why is that?