Skip to content

Commit

Permalink
Only load script if it ends in .lua
Browse files Browse the repository at this point in the history
  • Loading branch information
Sirius902 committed Aug 11, 2021
1 parent eaf8495 commit 186691a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions LuaBackendLIB/source/LuaBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void LuaBackend::LoadScripts(const char* ScrPath, uint64_t BaseInput)

string _filePath(_path.path().u8string());

if (_filePath.find(".lua") != std::string::npos)
if (_filePath.size() >= 4 && _filePath.find(".lua") == _filePath.size() - 4)
{
string _luaName = _filePath.substr(_filePath.find_last_of("\\") + 1);
_script->luaState["LUA_NAME"] = _luaName.substr(0, _luaName.size() - 4);
Expand Down Expand Up @@ -231,4 +231,4 @@ void LuaBackend::SetFunctions(LuaState* _state)
}
});

}
}

0 comments on commit 186691a

Please sign in to comment.