public ClrFunctionArguments DisallowType(DynValueType type) { if (Exists(x => x.Type == type)) { throw new ClrFunctionException($"The type '{type}' is invalid for this function call."); } return(this); }
public ClrFunctionArguments ExpectTypeAtIndex(int index, DynValueType type) { if (index >= Count) { throw new ClrFunctionException($"Expected type '{type}' at argument index {index}, found no value."); } if (this[index].Type != type) { throw new ClrFunctionException($"Expected type '{type}' at argument index {index}, found '{this[index].Type}"); } return(this); }
public ClrFunctionArguments ExpectTableAtIndex(int index, int size, DynValueType acceptedType) { ExpectTableAtIndex(index); if (this[index].Table.Count != size) { throw new ClrFunctionException( $"Expected a table of size {size} at index {index}. Actual size was {this[index].Table.Count}"); } if (!this[index].Table.All(x => x.Value.Type == acceptedType)) { throw new ClrFunctionException( $"Expected a table containing only {acceptedType}(s)."); } return(this); }
public InvalidDynValueTypeException(string message, DynValueType requestedType, DynValueType actualType) : base(message) { RequestedType = requestedType; ActualType = actualType; }