Skip to content

Commit

Permalink
Don't add auto started local Lua scripts twice
Browse files Browse the repository at this point in the history
  • Loading branch information
Assumeru committed Jan 1, 2025
1 parent b29949d commit f92b504
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/lua/scriptscontainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,16 @@ namespace LuaUtil
if (hasScript(scriptId))
return false; // already present

LoadedData& data = ensureLoaded();
if (data.mScripts.count(scriptId) != 0)
return false; // bail if the script we're adding was auto started

const VFS::Path::Normalized& path = scriptPath(scriptId);
std::string debugName = mNamePrefix;
debugName.push_back('[');
debugName.append(path);
debugName.push_back(']');

LoadedData& data = ensureLoaded();
Script& script = data.mScripts[scriptId];
script.mHiddenData = view.newTable();
script.mHiddenData[sScriptIdKey] = ScriptId{ this, scriptId };
Expand Down

0 comments on commit f92b504

Please sign in to comment.