M MY Multiplayer: Wiki
Side
Kind

getServerIp

Client

Returns the address of the server this client is connected to.

string getServerIp([bool withPort = false])

Parameters

NameTypeDescription
withPortboolIf true, :port is appended.default false

Returns

The address, with :port if asked. An empty string if the client is not connected.

Example

addCommandHandler("server", function()
    print("connected to " .. getServerIp(true))
end)

See also