summaryrefslogtreecommitdiffstats
path: root/src/Bindings
diff options
context:
space:
mode:
authorSTRWarrior <niels.breuker@hotmail.nl>2015-02-22 17:34:20 +0100
committerSTRWarrior <niels.breuker@hotmail.nl>2015-02-22 17:34:20 +0100
commit13f81a051d948fd5acb278c5d8679efa5fb3297c (patch)
treef2c89efe69e416b8e99ae693c5ce688cb5f8f9b3 /src/Bindings
parentDoor handler: Removed needless check. (diff)
downloadcuberite-13f81a051d948fd5acb278c5d8679efa5fb3297c.tar
cuberite-13f81a051d948fd5acb278c5d8679efa5fb3297c.tar.gz
cuberite-13f81a051d948fd5acb278c5d8679efa5fb3297c.tar.bz2
cuberite-13f81a051d948fd5acb278c5d8679efa5fb3297c.tar.lz
cuberite-13f81a051d948fd5acb278c5d8679efa5fb3297c.tar.xz
cuberite-13f81a051d948fd5acb278c5d8679efa5fb3297c.tar.zst
cuberite-13f81a051d948fd5acb278c5d8679efa5fb3297c.zip
Diffstat (limited to 'src/Bindings')
-rw-r--r--src/Bindings/ManualBindings.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp
index 69d16ac2b..ee3d81014 100644
--- a/src/Bindings/ManualBindings.cpp
+++ b/src/Bindings/ManualBindings.cpp
@@ -31,6 +31,7 @@
#include "../LineBlockTracer.h"
#include "../WorldStorage/SchematicFileSerializer.h"
#include "../CompositeChat.h"
+#include "../StringCompression.h"
@@ -110,6 +111,40 @@ static int tolua_Clamp(lua_State * tolua_S)
+static int tolua_CompressString(lua_State * tolua_S)
+{
+ cLuaState LuaState(tolua_S);
+ const char * ToCompress = tolua_tocppstring(LuaState, 1, 0);
+ int Length = (int)tolua_tonumber(LuaState, 2, 0);
+ int Factor = (int)tolua_tonumber(LuaState, 3, 0);
+ AString res;
+
+ CompressString(ToCompress, Length, res, Factor);
+ LuaState.Push(res);
+ return 1;
+}
+
+
+
+
+
+static int tolua_UncompressString(lua_State * tolua_S)
+{
+ cLuaState LuaState(tolua_S);
+ const char * ToUncompress = tolua_tocppstring(LuaState, 1, 0);
+ int Length = (int)tolua_tonumber(LuaState, 2, 0);
+ int UncompressedSize = (int)tolua_tonumber(LuaState, 3, 0);
+ AString res;
+
+ UncompressString(ToUncompress, Length, res, UncompressedSize);
+ LuaState.Push(res);
+ return 1;
+}
+
+
+
+
+
static int tolua_StringSplit(lua_State * tolua_S)
{
cLuaState LuaState(tolua_S);
@@ -3519,6 +3554,8 @@ void ManualBindings::Bind(lua_State * tolua_S)
// Globals:
tolua_function(tolua_S, "Clamp", tolua_Clamp);
+ tolua_function(tolua_S, "CompressString", tolua_CompressString);
+ tolua_function(tolua_S, "UncompressString", tolua_UncompressString);
tolua_function(tolua_S, "StringSplit", tolua_StringSplit);
tolua_function(tolua_S, "StringSplitAndTrim", tolua_StringSplitAndTrim);
tolua_function(tolua_S, "LOG", tolua_LOG);