fix crash when load locally and host server from gui, fix nil permissions

This commit is contained in:
mckaygerhard 2023-06-11 03:00:58 -04:00
parent b5b31941e3
commit b79404f7fa

View File

@ -19,6 +19,7 @@ else
end
function convert_ipv4( str )
if not str then str = "127.0.0.1" end -- started in local game or load the mod incorrectly
local ref = string.split( str, ".", false )
return tonumber( ref[ 1 ] ) * 16777216 + tonumber( ref[ 2 ] ) * 65536 + tonumber( ref[ 3 ] ) * 256 + tonumber( ref[ 4 ] )
end
@ -29,7 +30,8 @@ end
function get_default_privs( )
local default_privs = { }
for _, p in pairs( string.split( get_minetest_config( "default_privs" ), "," ) ) do
local config_privs = get_minetest_config( "default_privs" ) or "interact, shout"
for _, p in pairs( string.split( config_privs, "," ) ) do
table.insert( default_privs, string.trim( p ) )
end
return default_privs