Skip to content

Commit e817551

Browse files
authored
Merge pull request #143 from cortex-command-community/fix-script-cache-lookup
fix function lookup for chached scripts
2 parents 4668831 + de37b69 commit e817551

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Source/Managers/LuaMan.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,8 +740,10 @@ int LuaStateWrapper::RunScriptFileAndRetrieveFunctions(const std::string& filePa
740740
auto cachedScript = m_ScriptCache.find(filePath);
741741
if (!forceReload && cachedScript != m_ScriptCache.end()) {
742742
for (auto& pair: cachedScript->second.functionNamesAndObjects) {
743-
luabind::object* functionObjectCopyForStoring = new luabind::object(*pair.second->GetLuabindObject());
744-
outFunctionNamesAndObjects.try_emplace(pair.first, new LuabindObjectWrapper(functionObjectCopyForStoring, filePath));
743+
if (std::find(functionNamesToLookFor.begin(), functionNamesToLookFor.end(), pair.first) != functionNamesToLookFor.end()) {
744+
luabind::object* functionObjectCopyForStoring = new luabind::object(*pair.second->GetLuabindObject());
745+
outFunctionNamesAndObjects.try_emplace(pair.first, new LuabindObjectWrapper(functionObjectCopyForStoring, filePath));
746+
}
745747
}
746748

747749
return 0;

0 commit comments

Comments
 (0)