britzl
October 5, 2025, 9:26am
23
Domarius:
The steam extension provides the “total lobbies” number as a STRING ! (a discussion with ChatGPT explained that this is due to standard Lua not supporting 64 bit numbers internally, so it’s converted to a string to avoid precision loss)
On the client when you get LobbyMatchList_t you need to convert the total to a NUMBER:
I would say this is a bug. You surely won’t need 64 bits to store that number. Please open a bug report.
3 Likes
That’s what I thought - do we really need to account for the possibility of 18,446,744,073,709,551,615 lobbies? There aren’t even that many people in the world…
Done
opened 05:09PM - 05 Oct 25 UTC
# Description
When obtaining a list of lobbies using `steam.matchmaking_request_… lobby_list()` and getting steam event `LobbyMatchList_t` in response, `data.m_nLobbiesMatching)` is returned as a **string**.
This causes an insidious error when writing branching code for handling the case for no lobbies, since `if data.m_nLobbiesMatching > 0` will always return false no matter how many lobbies there are.
The example code happens to sidestep this issue in a subtle way; subtracting 1 from this string value causes Lua to evaluate this expression as a number:
https://github.com/defold/extension-steam/blob/352e090e2c41da6c3efabe0bca0e7eb2d6491110/examples/matchmaking/matchmaking.gui_script#L123
From what I can gather, the Steam SDK originally provides this value as a number, but for some reason it is stored in the steam extension using `table_push_uint64`
https://github.com/defold/extension-steam/blob/352e090e2c41da6c3efabe0bca0e7eb2d6491110/steam/src/steam_matchmaking.cpp#L20
ChatGPT says; while LuaJit supports 64bit integers, regular Lua doesn't, so somewhere along the line, this must get converted into a string to avoid precision loss, which would explain why it comes out as a string by the time we check the value inside a Defold Lua script.
# Expected
When getting steam event `LobbyMatchList_t`, the variable `data.m_nLobbiesMatching)` should be of type "number".
britzl
October 6, 2025, 5:51am
25
Fixed! I also did a larger overhaul of type handling and switched from lua_Number to lua_Integer when it made sense.
1 Like
That good to know! Thanks for the update!
@morgerion how the sam hill did you get that working? Because I’m getting a crash as soon as I receive a message:
opened 10:40PM - 07 Oct 25 UTC
# Issue
Program crash when calling function `steam.networking_receive_messages_o… n_channel()` when there are actually messages to receive.
# Platforms
Windows and Linux confirmed
# Steps to reproduce
1. Run the attached project [send_message.zip](https://github.com/user-attachments/files/22755132/send_message.zip) on 2 different devices ("Fetch Libraries" first), with Steam running on a different account each (device A and device B)
2. On device A, press 1 to create a lobby
3. On device B, press 2 to join the lobby and send a message
The app closes. On Windows, I didn't see any output in the console related to the crash. On Linux however, I got the following output. Note the end of the output, and that line main.script:100 is the line where `steam.networking_receive_messages_on_channel()` is called.
```
DEBUG:SCRIPT: Session request from user 76561198781318568, accepting... (this is where the crash occours)
DEBUG:SCRIPT: Steam event: PersonaStateChange_t
free(): double free detected in tcache 2
INFO:CRASH: Successfully wrote Crashdump to file: /home/domarius/.Defold/_crash
ERROR:CRASH: CALL STACK:
ERROR:CRASH: /mnt/user/Users/Domarius/Documents/My Files/Game Development/Test/Defold/extension-steam-bugs/send_message/build/x86_64-linux/dmengine(+0x334ab4) [0x5601135beab4]
ERROR:CRASH: /usr/lib/libc.so.6(+0x3e540) [0x7f54a1c3e540]
ERROR:CRASH: /usr/lib/libc.so.6(+0x9894c) [0x7f54a1c9894c]
ERROR:CRASH: /usr/lib/libc.so.6(gsignal+0x20) [0x7f54a1c3e410]
ERROR:CRASH: /usr/lib/libc.so.6(abort+0x26) [0x7f54a1c2557a]
ERROR:CRASH: /usr/lib/libc.so.6(+0x26613) [0x7f54a1c26613]
ERROR:CRASH: /usr/lib/libc.so.6(+0xa2d65) [0x7f54a1ca2d65]
ERROR:CRASH: /usr/lib/libc.so.6(+0xa82e8) [0x7f54a1ca82e8]
ERROR:CRASH: /mnt/user/Users/Domarius/Documents/My Files/Game Development/Test/Defold/extension-steam-bugs/send_message/build/x86_64-linux/dmengine(+0x430f89) [0x5601136baf89]
ERROR:CRASH: /mnt/user/Users/Domarius/Documents/My Files/Game Development/Test/Defold/extension-steam-bugs/send_message/build/x86_64-linux/dmengine(+0x22a556) [0x5601134b4556]
ERROR:CRASH: /mnt/user/Users/Domarius/Documents/My Files/Game Development/Test/Defold/extension-steam-bugs/send_message/build/x86_64-linux/dmengine(+0x21277c) [0x56011349c77c]
ERROR:CRASH: /mnt/user/Users/Domarius/Documents/My Files/Game Development/Test/Defold/extension-steam-bugs/send_message/build/x86_64-linux/dmengine(+0x1e55fd) [0x56011346f5fd]
ERROR:CRASH: /mnt/user/Users/Domarius/Documents/My Files/Game Development/Test/Defold/extension-steam-bugs/send_message/build/x86_64-linux/dmengine(+0x77ed1) [0x560113301ed1]
ERROR:CRASH: /mnt/user/Users/Domarius/Documents/My Files/Game Development/Test/Defold/extension-steam-bugs/send_message/build/x86_64-linux/dmengine(+0x781fc) [0x5601133021fc]
ERROR:CRASH: /mnt/user/Users/Domarius/Documents/My Files/Game Development/Test/Defold/extension-steam-bugs/send_message/build/x86_64-linux/dmengine(+0x67110) [0x5601132f1110]
ERROR:CRASH: /mnt/user/Users/Domarius/Documents/My Files/Game Development/Test/Defold/extension-steam-bugs/send_message/build/x86_64-linux/dmengine(+0x4683d) [0x5601132d083d]
ERROR:CRASH: /mnt/user/Users/Domarius/Documents/My Files/Game Development/Test/Defold/extension-steam-bugs/send_message/build/x86_64-linux/dmengine(+0x46fe5) [0x5601132d0fe5]
ERROR:CRASH: /mnt/user/Users/Domarius/Documents/My Files/Game Development/Test/Defold/extension-steam-bugs/send_message/build/x86_64-linux/dmengine(+0x427ff) [0x5601132cc7ff]
ERROR:CRASH: /mnt/user/Users/Domarius/Documents/My Files/Game Development/Test/Defold/extension-steam-bugs/send_message/build/x86_64-linux/dmengine(+0x42761) [0x5601132cc761]
ERROR:CRASH: /usr/lib/libc.so.6(+0x27675) [0x7f54a1c27675]
ERROR:CRASH: /usr/lib/libc.so.6(__libc_start_main+0x89) [0x7f54a1c27729]
ERROR:CRASH: /mnt/user/Users/Domarius/Documents/My Files/Game Development/Test/Defold/extension-steam-bugs/send_message/build/x86_64-linux/dmengine(+0x42555) [0x5601132cc555]
ERROR:CRASH: Lua Callstack:
ERROR:CRASH: main/main.script:100: in function <main/main.script:93>
ERROR:CRASH:
```