Skip to content

Show ip address in main menu#16974

Open
Alex37894 wants to merge 2 commits intoluanti-org:masterfrom
Alex37894:master
Open

Show ip address in main menu#16974
Alex37894 wants to merge 2 commits intoluanti-org:masterfrom
Alex37894:master

Conversation

@Alex37894
Copy link

Fixes: #15927

Add compact, short information about your PR for easier understanding:

Goal of the PR: Display the player's local IP address in the top-left corner of the main menu to facilitate LAN multiplayer.

How does the PR work ? :

  1. It adds a new C++ backend function l_get_local_ip in src/script/lua_api/l_mainmenu.cpp using getifaddrs to fetch local IPv4 addresses.
  2. It safely filters out loopback addresses (the 127.0.0.0/8 subnet) using bitwise masking (INADDR_LOOPBACK & IN_CLASSA_NET).
  3. It exposes this function to the Main Menu Lua environment as core.get_local_ip().
  4. In builtin/mainmenu/init.lua, it overrides core.set_topleft_text to append the retrieved IP address right below the engine version text.

Does it resolve any reported issue ?:
Yes, resolves #15927 (#15927).

Does this relate to a goal in the roadmap?:
Not directly, but it improves the general User Experience (UX) for multiplayer networking.

If this PR doesn't fix a bug, why is it necessary? What use cases does it solve ?
As requested in the ticket, it simplifies hosting local network games. Players no longer need to open a terminal or dig through operating system settings to find their local IP address; it's now directly visible on the home screen.

To do

This PR is a Ready for Review.

How to test

1 - Compile the Luanti engine on a Linux or macOS machine.

2 - Launch the game.

3 - On the main menu screen, look at the top-left corner (under the Luanti version and debug text).

4 - You should see IP Locale: [Your Local Network IP] (e.g., 192.168.1.50).

5 - Ensure it does not display 127.0.0.1.

luanti-ip

Alexis Damico and others added 2 commits February 23, 2026 11:15
@rubenwardy
Copy link
Contributor

This is wayy too prominent. If you think about when it's needed - someone joining your game - then just the pause menu should have this imo

@Alex37894
Copy link
Author

C'est beaucoup trop visible. Si on réfléchit aux situations où c'est nécessaire (par exemple, lorsqu'un joueur rejoint votre partie), alors, à mon avis, seul le menu pause devrait afficher cette information.

Maybeit should only be displayed in the menu where you create/join a world ?

@siliconsniffer
Copy link
Contributor

I don't really mind the IP address in the main menu but it should definitely be shown in the pause menu.

Since it's now enabled by default, does this work with IPv6 only? It should probably show a non-link-local one (ULA?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Display IP when Hosting Server from main-menu.

4 participants