private static NWN2ScriptVarTable removeDuplicates(NWN2ScriptVarTable varTable, LinkedList<String> toRemove) { // I remove any old duplicates LinkedList<NWN2ScriptVariable> varList = new LinkedList<NWN2ScriptVariable>(); foreach (NWN2ScriptVariable var in varTable.ToArray()) { if (toRemove.Contains(var.Name)) { varList.AddLast(var); } } foreach (NWN2ScriptVariable var in varList) { varTable.Remove(var); } return varTable; }
public static void DeleteStringArray(NWN2ScriptVarTable variables, string name) { try { for (uint i = 1; i < uint.MaxValue; i++) { NWN2ScriptVariable var = variables.GetVariable(name.Replace("*", i.ToString())); if (var.VariableType == NWN2ScriptVariableType.None) break; variables.Remove(var); } } catch { } }