mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 01:53:45 +01:00
Add get_server_max_lag() (#11671)
This commit is contained in:
parent
d7e7ade0f6
commit
4fca601e0c
@ -5647,6 +5647,8 @@ Server
|
|||||||
a player joined.
|
a player joined.
|
||||||
* This function may be overwritten by mods to customize the status message.
|
* This function may be overwritten by mods to customize the status message.
|
||||||
* `minetest.get_server_uptime()`: returns the server uptime in seconds
|
* `minetest.get_server_uptime()`: returns the server uptime in seconds
|
||||||
|
* `minetest.get_server_max_lag()`: returns the current maximum lag
|
||||||
|
of the server in seconds or nil if server is not fully loaded yet
|
||||||
* `minetest.remove_player(name)`: remove player from database (if they are not
|
* `minetest.remove_player(name)`: remove player from database (if they are not
|
||||||
connected).
|
connected).
|
||||||
* As auth data is not removed, minetest.player_exists will continue to
|
* As auth data is not removed, minetest.player_exists will continue to
|
||||||
|
@ -57,6 +57,17 @@ int ModApiServer::l_get_server_uptime(lua_State *L)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get_server_max_lag()
|
||||||
|
int ModApiServer::l_get_server_max_lag(lua_State *L)
|
||||||
|
{
|
||||||
|
NO_MAP_LOCK_REQUIRED;
|
||||||
|
ServerEnvironment *s_env = dynamic_cast<ServerEnvironment *>(getEnv(L));
|
||||||
|
if (!s_env)
|
||||||
|
lua_pushnil(L);
|
||||||
|
else
|
||||||
|
lua_pushnumber(L, s_env->getMaxLagEstimate());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// print(text)
|
// print(text)
|
||||||
int ModApiServer::l_print(lua_State *L)
|
int ModApiServer::l_print(lua_State *L)
|
||||||
@ -512,6 +523,7 @@ void ModApiServer::Initialize(lua_State *L, int top)
|
|||||||
API_FCT(request_shutdown);
|
API_FCT(request_shutdown);
|
||||||
API_FCT(get_server_status);
|
API_FCT(get_server_status);
|
||||||
API_FCT(get_server_uptime);
|
API_FCT(get_server_uptime);
|
||||||
|
API_FCT(get_server_max_lag);
|
||||||
API_FCT(get_worldpath);
|
API_FCT(get_worldpath);
|
||||||
API_FCT(is_singleplayer);
|
API_FCT(is_singleplayer);
|
||||||
|
|
||||||
|
@ -33,6 +33,9 @@ private:
|
|||||||
// get_server_uptime()
|
// get_server_uptime()
|
||||||
static int l_get_server_uptime(lua_State *L);
|
static int l_get_server_uptime(lua_State *L);
|
||||||
|
|
||||||
|
// get_server_max_lag()
|
||||||
|
static int l_get_server_max_lag(lua_State *L);
|
||||||
|
|
||||||
// get_worldpath()
|
// get_worldpath()
|
||||||
static int l_get_worldpath(lua_State *L);
|
static int l_get_worldpath(lua_State *L);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user