private void ReplaceScriptWithName(string name, Script value) { var s = GetScriptWithName(name); if (s == null) { Logger.Logi(LogType.Error, "Tried to replace script value with name '" + name + "' but it was not found."); } var addedScriptIndex = LoadedScripts.Count - 1; var instertIntoIndex = LoadedScripts.IndexOf(s); RemoveScript(s); AddScript(s); MoveScriptBefore(addedScriptIndex, instertIntoIndex); }