mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-15 01:25:20 +02:00
Refactor how script api reads current mod name
This is to prevent future mistakes and make it clearer whether the mod name can be trusted depending on how it is retrieved.
This commit is contained in:
@@ -82,8 +82,7 @@ EmergeThread *ModApiBase::getEmergeThread(lua_State *L)
|
||||
|
||||
std::string ModApiBase::getCurrentModPath(lua_State *L)
|
||||
{
|
||||
lua_rawgeti(L, LUA_REGISTRYINDEX, CUSTOM_RIDX_CURRENT_MOD_NAME);
|
||||
std::string current_mod_name = readParam<std::string>(L, -1, "");
|
||||
std::string current_mod_name = ScriptApiBase::getCurrentModNameInsecure(L);
|
||||
if (current_mod_name.empty())
|
||||
return ".";
|
||||
|
||||
|
Reference in New Issue
Block a user