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:
parent
227c71eb76
commit
eef62c82a2
35 changed files with 247 additions and 154 deletions
|
@ -524,7 +524,7 @@ bool ScriptApiSecurity::checkPath(lua_State *L, const char *path,
|
|||
// Get mod name
|
||||
lua_rawgeti(L, LUA_REGISTRYINDEX, CUSTOM_RIDX_CURRENT_MOD_NAME);
|
||||
if (lua_isstring(L, -1)) {
|
||||
std::string mod_name = lua_tostring(L, -1);
|
||||
std::string mod_name = readParam<std::string>(L, -1);
|
||||
|
||||
// Builtin can access anything
|
||||
if (mod_name == BUILTIN_MOD_NAME) {
|
||||
|
@ -649,7 +649,7 @@ int ScriptApiSecurity::sl_g_loadfile(lua_State *L)
|
|||
lua_pop(L, 1);
|
||||
|
||||
if (script->getType() == ScriptingType::Client) {
|
||||
std:: string display_path = lua_tostring(L, 1);
|
||||
std::string display_path = readParam<std::string>(L, 1);
|
||||
const std::string *path = script->getClient()->getModFile(display_path);
|
||||
if (!path) {
|
||||
std::string error_msg = "Coudln't find script called:" + display_path;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue