From eef62c82a2e58700fc1216b0b8c03e421bc77995 Mon Sep 17 00:00:00 2001 From: Loïc Blot Date: Sat, 30 Jun 2018 17:11:38 +0200 Subject: Modernize lua read (part 2 & 3): C++ templating assurance (#7410) * Modernize lua read (part 2 & 3): C++ templating assurance Implement the boolean reader Implement the string reader Also remove unused & unimplemented script_error_handler Add a reader with default value --- src/script/lua_api/l_http.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/script/lua_api/l_http.cpp') diff --git a/src/script/lua_api/l_http.cpp b/src/script/lua_api/l_http.cpp index 641f4194a..ac261cd60 100644 --- a/src/script/lua_api/l_http.cpp +++ b/src/script/lua_api/l_http.cpp @@ -59,7 +59,7 @@ void ModApiHttp::read_http_fetch_request(lua_State *L, HTTPFetchRequest &req) lua_pop(L, 1); } } else if (lua_isstring(L, 2)) { - req.post_data = lua_tostring(L, 2); + req.post_data = readParam(L, 2); } lua_pop(L, 1); @@ -154,7 +154,7 @@ int ModApiHttp::l_request_http_api(lua_State *L) return 0; } - const char *mod_name = lua_tostring(L, -1); + std::string mod_name = readParam(L, -1); std::string http_mods = g_settings->get("secure.http_mods"); http_mods.erase(std::remove(http_mods.begin(), http_mods.end(), ' '), http_mods.end()); std::vector mod_list_http = str_split(http_mods, ','); -- cgit v1.2.3