Closed synesthesium closed 1 year ago
You can use Gmod's game.GetIPAddress
function to retrieve the IP and port of the host you are connecting to. FYI, it's lua/includes/init.lua
, not includes/init.lua
(remember the prefix, e.g. lua
, gamemode
, etc).
print(gluasteal.SCRIPT)
if gluasteal.SCRIPT == "lua/includes/init.lua" then
print("host ip", game.GetIPAddress())
end
Clientside Lua startup!
lua/includes/init.lua
host ip 45.88.1.1:27026
lua/includes/util.lua
lua/includes/util/color.lua
lua/includes/util/sql.lua
lua/includes/extensions/net.lua
lua/includes/modules/baseclass.lua
Huh. I read that game.GetIPAddress() reported wrong data occasionally.
Anyways, as for including lua
, that also solves #54, but I'm curious as to why the examples do not reflect that?
Woops! I'll update the readme now. Thanks. game.GetIPAddress()
seems to work fine at the moment but if it does return wrong data I'll happily add something like gluasteal.SERVER.
Maybe something like
gluasteal.SERVER
so that something like this can be written?