# Problem with list leaderboard from lua runtime function

**URL:** <https://forum.heroiclabs.com/t/problem-with-list-leaderboard-from-lua-runtime-function/951>\
**Category:** Game Design\
**Tags:** server-framework\
**Created:** [September 1, 2020, 4:16pm UTC](https://forum.heroiclabs.com/t/problem-with-list-leaderboard-from-lua-runtime-function/951 "2020-09-01T16:16:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![antoniocapizzi95](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/antoniocapizzi95/32/234_2.png) [@antoniocapizzi95](https://forum.heroiclabs.com/u/antoniocapizzi95)\
**Post date:** [September 1, 2020, 4:16pm UTC](https://forum.heroiclabs.com/t/problem-with-list-leaderboard-from-lua-runtime-function/951/1 "2020-09-01T16:16:30Z")

</div>

Hello everyone, I’m using Nakama server v2.12.0, I need to create an rpc function that takes the lines of a leaderboard and sends a notification to all users on that leaderboard. The problem is that when I use the “nk.leaderboard\_records\_list(id, owners, limit)” function I always get an empty array. In the parameters I put the id of the leaderboard I want to consult, as owners I putan empty object (it’s optional) and as limit I put 100. The leaderboard id I put is correct, it is a leaderboard with many records. Can someone tell me what I’m wrong? Thanks.

---

<div class="post-metadata">

**Author:** ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)\
**Post date:** [September 1, 2020, 10:09pm UTC](https://forum.heroiclabs.com/t/problem-with-list-leaderboard-from-lua-runtime-function/951/2 "2020-09-01T22:09:54Z")

</div>

@antoniocapizzi95 What does the specific code you use look like? There’s no known issue with that server function. Are you sure you iterate over the returned LTable correctly?

---

<div class="post-metadata">

**Author:** ![antoniocapizzi95](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/antoniocapizzi95/32/234_2.png) [@antoniocapizzi95](https://forum.heroiclabs.com/u/antoniocapizzi95)\
**Post date:** [September 2, 2020, 9:20am UTC](https://forum.heroiclabs.com/t/problem-with-list-leaderboard-from-lua-runtime-function/951/3 "2020-09-02T09:20:54Z")

</div>

I’m using this code:

```auto
local records, owner_records, next_cursor, prev_cursor = nk.leaderboard_records_list(id, owners, limit)

```

As id I put the id of a leaderboard containing a lot of rows. After I return the length of “records” (is a table) and I obtain 0. This is strange, because if i try to get the same leaderboard from client (with Unity library), i get 100 rows (i set the limit to 100).

---

<div class="post-metadata">

**Author:** ![zyro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/zyro/32/14_2.png) [@zyro](https://forum.heroiclabs.com/u/zyro)\
**Post date:** [September 3, 2020, 10:06am UTC](https://forum.heroiclabs.com/t/problem-with-list-leaderboard-from-lua-runtime-function/951/4 "2020-09-03T10:06:12Z")

</div>

@antoniocapizzi95 Have you checked the contents of `owner_records`? If you’re filtering the request by `owners` that should contain the appropriate filtered results.

---

<div class="post-metadata">

**Author:** ![SirCez](https://avatars.discourse-cdn.com/v4/letter/s/cdc98d/32.png) [@SirCez](https://forum.heroiclabs.com/u/SirCez)\
**Post date:** [September 7, 2024, 9:35pm UTC](https://forum.heroiclabs.com/t/problem-with-list-leaderboard-from-lua-runtime-function/951/5 "2024-09-07T21:35:33Z")

</div>

I am having this exact same issue. Here is the code I am using. It returns an empty table.

```auto
local id = "league1-tier-1"
local owners = {}
local limit = 100
local cursor = ""
local overrideExpiry = 3600
local records, ownerRecords, nextCursor, prevCursor = nk.leaderboard_records_list(id, owners, limit, cursor, overrideExpiry)
local resp = {records = records, ownerRecords = ownerRecords, nextCursor = nextCursor, prevCursor = prevCursor}

return nk.json_encode(resp)

```

UPDATE  
The documentation seems to be wrong/out of date. You need to pass nil for the owners parameter. If you pass an empty table {} as stated in the official lua runtime example, you will get an empty result set.

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [September 9, 2024, 8:26am UTC](https://forum.heroiclabs.com/t/problem-with-list-leaderboard-from-lua-runtime-function/951/6 "2024-09-09T08:26:03Z")

</div>

@SirCez we’ll change the documentation to make it clearer clearer. cc @HeroicNathan.
