int FromVariableIndexName(MegaloScriptVariableType type, string name) { int id = TypeExtensionsBlam.IndexOfByPropertyNotFoundResult; switch (type) { case MegaloScriptVariableType.Numeric: id = MegaloScriptModel.FindNameIndex(Numerics, name); break; case MegaloScriptVariableType.Timer: id = MegaloScriptModel.FindNameIndex(Timers, name); break; case MegaloScriptVariableType.Team: id = MegaloScriptModel.FindNameIndex(Teams, name); break; case MegaloScriptVariableType.Player: id = MegaloScriptModel.FindNameIndex(Players, name); break; case MegaloScriptVariableType.Object: id = MegaloScriptModel.FindNameIndex(Objects, name); break; default: throw new KSoft.Debug.UnreachableException(type.ToString()); } if (id == TypeExtensionsBlam.IndexOfByPropertyNotFoundResult) { throw new KeyNotFoundException(string.Format("Couldn't find {0} {1} variable named {2}", SetType, type, name)); } return(id); }