aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorred-001 <red-001@outlook.ie>2017-04-06 21:50:45 +0100
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-04-06 22:50:45 +0200
commit88b9b9652ab77f91eaa7c6e40b8a48e3a35a7948 (patch)
tree54cc23c5eead39211d2dadbf1be0e02f90f41f0a /src
parentbe0663696514dd3d3525949be7c317c9eae9dbb0 (diff)
downloadminetest-88b9b9652ab77f91eaa7c6e40b8a48e3a35a7948.tar.gz
minetest-88b9b9652ab77f91eaa7c6e40b8a48e3a35a7948.tar.bz2
minetest-88b9b9652ab77f91eaa7c6e40b8a48e3a35a7948.zip
[CSM] Add function to get the server protocol version. (#5529)
Diffstat (limited to 'src')
-rw-r--r--src/script/lua_api/l_client.cpp8
-rw-r--r--src/script/lua_api/l_client.h3
2 files changed, 11 insertions, 0 deletions
diff --git a/src/script/lua_api/l_client.cpp b/src/script/lua_api/l_client.cpp
index 458c1d1f4..0f4d7eaae 100644
--- a/src/script/lua_api/l_client.cpp
+++ b/src/script/lua_api/l_client.cpp
@@ -234,6 +234,13 @@ int ModApiClient::l_sound_stop(lua_State *L)
return 0;
}
+// get_protocol_version()
+int ModApiClient::l_get_protocol_version(lua_State *L)
+{
+ lua_pushinteger(L, getClient(L)->getProtoVersion());
+ return 1;
+}
+
void ModApiClient::Initialize(lua_State *L, int top)
{
API_FCT(get_current_modname);
@@ -251,4 +258,5 @@ void ModApiClient::Initialize(lua_State *L, int top)
API_FCT(get_meta);
API_FCT(sound_play);
API_FCT(sound_stop);
+ API_FCT(get_protocol_version);
}
diff --git a/src/script/lua_api/l_client.h b/src/script/lua_api/l_client.h
index 4e7f63d6a..478b8ed6c 100644
--- a/src/script/lua_api/l_client.h
+++ b/src/script/lua_api/l_client.h
@@ -69,6 +69,9 @@ private:
static int l_sound_stop(lua_State *L);
+ // get_protocol_version()
+ static int l_get_protocol_version(lua_State *L);
+
public:
static void Initialize(lua_State *L, int top);
};