Hello there,
I tried to add a scoreboard, but I get the this error:
{"level":"error","ts":"2022-02-03T22:13:39.731+0100","caller":"server/runtime_lua.go:1889","msg":"Could not complete runtime invocation","error":"/nakama/data/modules/birds.lua:8: attempt to index a non-table object(nil) with key 'leaderboard_create'\nstack traceback:\n\t/nakama/data/modules/birds.lua:8: in main chunk\n\t[G]: ?"}
{"level":"error","ts":"2022-02-03T22:13:39.731+0100","caller":"server/runtime.go:592","msg":"Error initialising Lua runtime provider","error":"/nakama/data/modules/birds.lua:8: attempt to index a non-table object(nil) with key 'leaderboard_create'\nstack traceback:\n\t/nakama/data/modules/birds.lua:8: in main chunk\n\t[G]: ?"}
{"level":"fatal","ts":"2022-02-03T22:13:39.731+0100","caller":"v3/main.go:146","msg":"Failed initializing runtime modules","error":"/nakama/data/modules/birds.lua:8: attempt to index a non-table object(nil) with key 'leaderboard_create'\nstack traceback:\n\t/nakama/data/modules/birds.lua:8: in main chunk\n\t[G]: ?"}
I use the example on the documentation site:
This is my code:
1 local id = "birds_4"
2 local authoritative = false
3 local sort = "asc"
4 local operator = "best"
5 local metadata = {
6 moves = 0
7 }
8 nk.leaderboard_create(id, authoritative, sort, operator, metadata)
Where is my fault?
Thanks
Hello @neronekro, welcome to the forum.
I think you’re missing the nakama module import statement at the top of your script:
local nk = require("nakama")
Let me know if it resolves your issue.
thx, some kind of stupidy.
However, run into the next error. Maybe it’s also because of the time 
{"level":"error","ts":"2022-02-03T22:39:02.616+0100","caller":"server/runtime_lua.go:1889","msg":"Could not complete runtime invocation","error":"/nakama/data/modules/birds.lua:9: bad argument #5 to leaderboard_create (string expected, got table)\nstack traceback:\n\t[G]: in function 'leaderboard_create'\n\t/nakama/data/modules/birds.lua:9: in main chunk\n\t[G]: ?"}
{"level":"error","ts":"2022-02-03T22:39:02.616+0100","caller":"server/runtime.go:592","msg":"Error initialising Lua runtime provider","error":"/nakama/data/modules/birds.lua:9: bad argument #5 to leaderboard_create (string expected, got table)\nstack traceback:\n\t[G]: in function 'leaderboard_create'\n\t/nakama/data/modules/birds.lua:9: in main chunk\n\t[G]: ?"}
{"level":"fatal","ts":"2022-02-03T22:39:02.616+0100","caller":"v3/main.go:146","msg":"Failed initializing runtime modules","error":"/nakama/data/modules/birds.lua:9: bad argument #5 to leaderboard_create (string expected, got table)\nstack traceback:\n\t[G]: in function 'leaderboard_create'\n\t/nakama/data/modules/birds.lua:9: in main chunk\n\t[G]: ?"}
1 local nk = require("nakama")
2 local id = "birds_4"
3 local authoritative = false
4 local sort = "asc"
5 local operator = "best"
6 local metadata = {
7 moves = "0"
8 }
9 nk.leaderboard_create(id, authoritative, sort, operator, metadata)
no problem, as per the following documentation snippet:
local id = "level1"
local authoritative = false
local sort = "desc"
local operator = "best"
local reset = "0 0 * * 1"
local metadata = {
weather_conditions = "rain"
}
nk.leaderboard_create(id, authoritative, sort, operator, reset, metadata)
the #5 argument expects a cron expression for the reset, if you do not wish for the leaderboard to reset then just pass an empty string ""