summaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_server.cpp
diff options
context:
space:
mode:
authorBrandon <brandon@bremaweb.com>2016-11-02 11:36:58 -0500
committerAuke Kok <sofar+github@foo-projects.org>2016-11-02 09:36:58 -0700
commitbf315c05f17549d37d7b4c4bd7938df0b5b32c5a (patch)
treec04f306861d9cee09b0e108e46a6036763526e0c /src/script/lua_api/l_server.cpp
parent7607b0ac2065a50a9b68b22909ab40738f2d08e8 (diff)
downloadminetest-bf315c05f17549d37d7b4c4bd7938df0b5b32c5a.tar.gz
minetest-bf315c05f17549d37d7b4c4bd7938df0b5b32c5a.tar.bz2
minetest-bf315c05f17549d37d7b4c4bd7938df0b5b32c5a.zip
Add minetest.get_server_uptime() function to Lua API (#4702)
Add minetest.get_server_uptime() function to Lua API
Diffstat (limited to 'src/script/lua_api/l_server.cpp')
-rw-r--r--src/script/lua_api/l_server.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/script/lua_api/l_server.cpp b/src/script/lua_api/l_server.cpp
index 95e5da07f..b6d44e0ff 100644
--- a/src/script/lua_api/l_server.cpp
+++ b/src/script/lua_api/l_server.cpp
@@ -45,6 +45,15 @@ int ModApiServer::l_get_server_status(lua_State *L)
return 1;
}
+// get_server_uptime()
+int ModApiServer::l_get_server_uptime(lua_State *L)
+{
+ NO_MAP_LOCK_REQUIRED;
+ lua_pushnumber(L, getServer(L)->getUptime());
+ return 1;
+}
+
+
// print(text)
int ModApiServer::l_print(lua_State *L)
{
@@ -507,6 +516,7 @@ void ModApiServer::Initialize(lua_State *L, int top)
{
API_FCT(request_shutdown);
API_FCT(get_server_status);
+ API_FCT(get_server_uptime);
API_FCT(get_worldpath);
API_FCT(is_singleplayer);