1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

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
This commit is contained in:
Loïc Blot 2018-06-30 17:11:38 +02:00 committed by GitHub
parent 227c71eb76
commit eef62c82a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 247 additions and 154 deletions

View file

@ -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<std::string>(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<std::string>(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<std::string> mod_list_http = str_split(http_mods, ',');