I am getting error in fetching list of friends. my code is
local nk = require(“nakama”)
local function friends_list(context, payload)
local user_id=context.user_id
local limit=100
– States are: friend(0), invite_sent(1), invite_received(2), blocked(3)
local state=0
local cursor=nil
local friends=nk.friends_list(user_id, state, limit, cursor)
–local friends=nk.account_get_id(user_id)
–for _, m in ipairs(friends)
–do
– States are: friend(0), invite_sent(1), invite_received(2), blocked(3)
– local msg = string.format(“Friend username %q has state %q”, m.user.username, m.state)
– nk.logger_info(msg)
–end
return nk.json_encode(friends)
end
nk.register_rpc(friends_list,“freindlist”)
Getting Error
{“code”:13,“error”:{“Type”:2,“Object”:"/nakama/data/modules/friends_list.lua:9: attempt to call a non-function object",“StackTrace”:“stack traceback:\n\t/nakama/data/modules/friends_list.lua:9: in main chunk\n\t[G]: ?”,“Cause”:null},“message”:"/nakama/data/modules/friends_list.lua:9: attempt to call a non-function object\nstack traceback:\n\t/nakama/data/modules/friends_list.lua:9: in main chunk\n