mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Do not load mod if given init script doesn't exist
This commit is contained in:
parent
350c391b05
commit
ac8de2173a
1 changed files with 5 additions and 0 deletions
|
@ -266,6 +266,11 @@ std::string ScriptApiBase::getCurrentModName(lua_State *L)
|
|||
void ScriptApiBase::loadMod(const std::string &script_path,
|
||||
const std::string &mod_name)
|
||||
{
|
||||
if (!fs::IsFile(script_path)) {
|
||||
errorstream << "Mod error: Failed to load mod \"" << mod_name
|
||||
<< "\" as script \"" << script_path << "\" does not exist" << std::endl;
|
||||
return;
|
||||
}
|
||||
ModNameStorer mod_name_storer(getStack(), mod_name);
|
||||
|
||||
loadScript(script_path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue