summaryrefslogtreecommitdiffstats
path: root/src/Bindings/ManualBindings.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2016-12-25 18:29:21 +0100
committerGitHub <noreply@github.com>2016-12-25 18:29:21 +0100
commitb3b723b4531a3781ab847a2652cf192303e78941 (patch)
treec7c3169575541c662438834973a5c7fc34188a70 /src/Bindings/ManualBindings.cpp
parentUpdated links and docs (#3488) (diff)
downloadcuberite-b3b723b4531a3781ab847a2652cf192303e78941.tar
cuberite-b3b723b4531a3781ab847a2652cf192303e78941.tar.gz
cuberite-b3b723b4531a3781ab847a2652cf192303e78941.tar.bz2
cuberite-b3b723b4531a3781ab847a2652cf192303e78941.tar.lz
cuberite-b3b723b4531a3781ab847a2652cf192303e78941.tar.xz
cuberite-b3b723b4531a3781ab847a2652cf192303e78941.tar.zst
cuberite-b3b723b4531a3781ab847a2652cf192303e78941.zip
Diffstat (limited to '')
-rw-r--r--src/Bindings/ManualBindings.cpp85
1 files changed, 67 insertions, 18 deletions
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp
index 1fe3c0f9f..34357eb65 100644
--- a/src/Bindings/ManualBindings.cpp
+++ b/src/Bindings/ManualBindings.cpp
@@ -2112,6 +2112,66 @@ static int tolua_cUrlParser_ParseAuthorityPart(lua_State * a_LuaState)
+static int tolua_cUrlParser_UrlDecode(lua_State * tolua_S)
+{
+ // Check the param types:
+ cLuaState S(tolua_S);
+ if (
+ // Don't care about the first param
+ !S.CheckParamString(2) ||
+ !S.CheckParamEnd(3)
+ )
+ {
+ return 0;
+ }
+
+ // Get the parameters:
+ AString Input;
+ S.GetStackValue(2, Input);
+
+ // Convert and return:
+ auto res = URLDecode(Input);
+ if (res.first)
+ {
+ S.Push(res.second);
+ }
+ else
+ {
+ S.Push(cLuaState::Nil);
+ }
+ return 1;
+}
+
+
+
+
+
+static int tolua_cUrlParser_UrlEncode(lua_State * tolua_S)
+{
+ // Check the param types:
+ cLuaState S(tolua_S);
+ if (
+ // Don't care about the first param
+ !S.CheckParamString(2) ||
+ !S.CheckParamEnd(3)
+ )
+ {
+ return 0;
+ }
+
+ // Get the parameters:
+ AString Input;
+ S.GetStackValue(2, Input);
+
+ // Convert and return:
+ S.Push(URLEncode(Input));
+ return 1;
+}
+
+
+
+
+
static int tolua_cWebAdmin_AddWebTab(lua_State * tolua_S)
{
// Function signatures:
@@ -2324,28 +2384,15 @@ static int tolua_cWebAdmin_GetPage(lua_State * tolua_S)
-/** Binding for cWebAdmin::GetURLEncodedString.
-Manual code required because ToLua generates an extra return value */
+/** Binding for cWebAdmin::GetURLEncodedString. */
static int tolua_cWebAdmin_GetURLEncodedString(lua_State * tolua_S)
{
- // Check the param types:
+ // Emit the obsoletion warning:
cLuaState S(tolua_S);
- if (
- // Don't care whether the first param is a cWebAdmin instance or class
- !S.CheckParamString(2) ||
- !S.CheckParamEnd(3)
- )
- {
- return 0;
- }
-
- // Get the parameters:
- AString Input;
- S.GetStackValue(2, Input);
+ LOGWARNING("cWebAdmin:GetURLEncodedString() is obsolete, use cUrlParser:UrlEncode() instead.");
+ S.LogStackTrace();
- // Convert and return:
- S.Push(cWebAdmin::GetURLEncodedString(Input));
- return 1;
+ return tolua_cUrlParser_UrlEncode(tolua_S);
}
@@ -4042,6 +4089,8 @@ void cManualBindings::Bind(lua_State * tolua_S)
tolua_function(tolua_S, "IsKnownScheme", tolua_cUrlParser_IsKnownScheme);
tolua_function(tolua_S, "Parse", tolua_cUrlParser_Parse);
tolua_function(tolua_S, "ParseAuthorityPart", tolua_cUrlParser_ParseAuthorityPart);
+ tolua_function(tolua_S, "UrlDecode", tolua_cUrlParser_UrlDecode);
+ tolua_function(tolua_S, "UrlEncode", tolua_cUrlParser_UrlEncode);
tolua_endmodule(tolua_S);
tolua_beginmodule(tolua_S, "cWebAdmin");