summaryrefslogtreecommitdiffstats
path: root/src/Bindings/ManualBindings.cpp
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-04-02 15:37:24 +0200
committerTycho <work.tycho+git@gmail.com>2014-04-02 15:37:24 +0200
commit741a64c250a1085108f24f351e9d9dacd085cc82 (patch)
treea69b5aba676473e5f75822a02e14e2acc542b263 /src/Bindings/ManualBindings.cpp
parentFixed All signedness warnings in HTTPServer.cpp (diff)
parentMerge branch 'master' into globals (diff)
downloadcuberite-741a64c250a1085108f24f351e9d9dacd085cc82.tar
cuberite-741a64c250a1085108f24f351e9d9dacd085cc82.tar.gz
cuberite-741a64c250a1085108f24f351e9d9dacd085cc82.tar.bz2
cuberite-741a64c250a1085108f24f351e9d9dacd085cc82.tar.lz
cuberite-741a64c250a1085108f24f351e9d9dacd085cc82.tar.xz
cuberite-741a64c250a1085108f24f351e9d9dacd085cc82.tar.zst
cuberite-741a64c250a1085108f24f351e9d9dacd085cc82.zip
Diffstat (limited to 'src/Bindings/ManualBindings.cpp')
-rw-r--r--src/Bindings/ManualBindings.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp
index 9d1a367df..51b9f3e27 100644
--- a/src/Bindings/ManualBindings.cpp
+++ b/src/Bindings/ManualBindings.cpp
@@ -190,6 +190,50 @@ static int tolua_LOGERROR(lua_State * tolua_S)
+static int tolua_Base64Encode(lua_State * tolua_S)
+{
+ cLuaState L(tolua_S);
+ if (
+ !L.CheckParamString(1) ||
+ !L.CheckParamEnd(2)
+ )
+ {
+ return 0;
+ }
+
+ AString Src;
+ L.GetStackValue(1, Src);
+ AString res = Base64Encode(Src);
+ L.Push(res);
+ return 1;
+}
+
+
+
+
+
+static int tolua_Base64Decode(lua_State * tolua_S)
+{
+ cLuaState L(tolua_S);
+ if (
+ !L.CheckParamString(1) ||
+ !L.CheckParamEnd(2)
+ )
+ {
+ return 0;
+ }
+
+ AString Src;
+ L.GetStackValue(1, Src);
+ AString res = Base64Decode(Src);
+ L.Push(res);
+ return 1;
+}
+
+
+
+
+
cPluginLua * GetLuaPlugin(lua_State * L)
{
// Get the plugin identification out of LuaState:
@@ -2869,6 +2913,8 @@ void ManualBindings::Bind(lua_State * tolua_S)
tolua_function(tolua_S, "LOGWARN", tolua_LOGWARN);
tolua_function(tolua_S, "LOGWARNING", tolua_LOGWARN);
tolua_function(tolua_S, "LOGERROR", tolua_LOGERROR);
+ tolua_function(tolua_S, "Base64Encode", tolua_Base64Encode);
+ tolua_function(tolua_S, "Base64Decode", tolua_Base64Decode);
tolua_beginmodule(tolua_S, "cFile");
tolua_function(tolua_S, "GetFolderContents", tolua_cFile_GetFolderContents);