Skip to content

Commit de37b69

Browse files
committed
fix function lookup for chached scripts
function lookup will now still check function names even when reading already cached scripts
1 parent 4668831 commit de37b69

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)