Show / Hide Table of Contents

Class ScriptRuntimeException

Exception for all runtime errors. In addition to constructors, it offers a lot of static methods generating more "standard" Lua errors.

Inheritance
System.Object
InterpreterException
ScriptRuntimeException
DynamicExpressionException
Inherited Members
InterpreterException.InstructionPtr
InterpreterException.CallStack
InterpreterException.DecoratedMessage
InterpreterException.DoNotDecorateMessage
Namespace: System.Dynamic.ExpandoObject
Assembly: cs.temp.dll.dll
Syntax
public class ScriptRuntimeException : InterpreterException

Constructors

ScriptRuntimeException(Exception)

Initializes a new instance of the ScriptRuntimeException class.

Declaration
public ScriptRuntimeException(Exception ex)
Parameters
Exception ex

The ex.

ScriptRuntimeException(ScriptRuntimeException)

Initializes a new instance of the ScriptRuntimeException class.

Declaration
public ScriptRuntimeException(ScriptRuntimeException ex)
Parameters
ScriptRuntimeException ex

The ex.

ScriptRuntimeException(String)

Initializes a new instance of the ScriptRuntimeException class.

Declaration
public ScriptRuntimeException(string message)
Parameters
System.String message

The message that describes the error.

ScriptRuntimeException(String, Object[])

Initializes a new instance of the ScriptRuntimeException class.

Declaration
public ScriptRuntimeException(string format, params object[] args)
Parameters
System.String format

The format.

System.Object[] args

The arguments.

Methods

AccessInstanceMemberOnStatics(IMemberDescriptor)

Creates a ScriptRuntimeException with a predefined error message specifying that an attempt to access a non-static member from a static userdata was made

Declaration
public static ScriptRuntimeException AccessInstanceMemberOnStatics(IMemberDescriptor desc)
Parameters
IMemberDescriptor desc

The member descriptor.

Returns
ScriptRuntimeException

AccessInstanceMemberOnStatics(IUserDataDescriptor, IMemberDescriptor)

Creates a ScriptRuntimeException with a predefined error message specifying that an attempt to access a non-static member from a static userdata was made

Declaration
public static ScriptRuntimeException AccessInstanceMemberOnStatics(IUserDataDescriptor typeDescr, IMemberDescriptor desc)
Parameters
IUserDataDescriptor typeDescr

The type descriptor.

IMemberDescriptor desc

The member descriptor.

Returns
ScriptRuntimeException

ArithmeticOnNonNumber(DynValue, DynValue)

Creates a ScriptRuntimeException with a predefined error message specifying that an arithmetic operation was attempted on non-numbers

Declaration
public static ScriptRuntimeException ArithmeticOnNonNumber(DynValue l, DynValue r = null)
Parameters
DynValue l

The left operand.

DynValue r

The right operand (or null).

Returns
ScriptRuntimeException

The exception to be raised.

Exceptions
InternalErrorException

If both are numbers

AttemptToCallNonFunc(DataType, String)

Creates a ScriptRuntimeException with a predefined error message specifying that an attempt to call a non-function was made

Declaration
public static ScriptRuntimeException AttemptToCallNonFunc(DataType type, string debugText = null)
Parameters
DataType type

The lua non-function data type.

System.String debugText

The debug text to aid location (appears as "near 'xxx'").

Returns
ScriptRuntimeException

BadArgument(Int32, String, DataType, DataType, Boolean)

Creates a ScriptRuntimeException with a predefined error message specifying that a function was called with a bad argument

Declaration
public static ScriptRuntimeException BadArgument(int argNum, string funcName, DataType expected, DataType got, bool allowNil)
Parameters
System.Int32 argNum

The argument number (0-based).

System.String funcName

Name of the function generating this error.

DataType expected

The expected data type.

DataType got

The data type received.

System.Boolean allowNil

True if nils were allowed in this call.

Returns
ScriptRuntimeException

The exception to be raised.

BadArgument(Int32, String, String)

Creates a ScriptRuntimeException with a predefined error message specifying that a function was called with a bad argument

Declaration
public static ScriptRuntimeException BadArgument(int argNum, string funcName, string message)
Parameters
System.Int32 argNum

The argument number (0-based).

System.String funcName

Name of the function generating this error.

System.String message

The error message.

Returns
ScriptRuntimeException

The exception to be raised.

BadArgument(Int32, String, String, String, Boolean)

Creates a ScriptRuntimeException with a predefined error message specifying that a function was called with a bad argument

Declaration
public static ScriptRuntimeException BadArgument(int argNum, string funcName, string expected, string got, bool allowNil)
Parameters
System.Int32 argNum

The argument number (0-based).

System.String funcName

Name of the function generating this error.

System.String expected

The expected type description.

System.String got

The description of the type received.

System.Boolean allowNil

True if nils were allowed in this call.

Returns
ScriptRuntimeException

The exception to be raised.

BadArgumentIndexOutOfRange(String, Int32)

Creates a ScriptRuntimeException with a predefined error message specifying that an out of range index was specified

Declaration
public static ScriptRuntimeException BadArgumentIndexOutOfRange(string funcName, int argNum)
Parameters
System.String funcName

Name of the function generating this error.

System.Int32 argNum

The argument number (0-based).

Returns
ScriptRuntimeException

The exception to be raised.

BadArgumentNoNegativeNumbers(Int32, String)

Creates a ScriptRuntimeException with a predefined error message specifying that a function was called with a negative number when a positive one was expected.

Declaration
public static ScriptRuntimeException BadArgumentNoNegativeNumbers(int argNum, string funcName)
Parameters
System.Int32 argNum

The argument number (0-based).

System.String funcName

Name of the function generating this error.

Returns
ScriptRuntimeException

The exception to be raised.

BadArgumentNoValue(Int32, String, DataType)

Creates a ScriptRuntimeException with a predefined error message specifying that a function was called with no value when a value was required.

This function creates a message like "bad argument #xxx to 'yyy' (zzz expected, got no value)" while BadArgumentValueExpected(Int32, String) creates a message like "bad argument #xxx to 'yyy' (value expected)"

Declaration
public static ScriptRuntimeException BadArgumentNoValue(int argNum, string funcName, DataType expected)
Parameters
System.Int32 argNum

The argument number (0-based).

System.String funcName

Name of the function generating this error.

DataType expected

The expected data type.

Returns
ScriptRuntimeException

The exception to be raised.

BadArgumentUserData(Int32, String, Type, Object, Boolean)

Creates a ScriptRuntimeException with a predefined error message specifying that a function was called with a bad userdata argument

Declaration
public static ScriptRuntimeException BadArgumentUserData(int argNum, string funcName, Type expected, object got, bool allowNil)
Parameters
System.Int32 argNum

The argument number (0-based).

System.String funcName

Name of the function generating this error.

Type expected

The expected System.Type.

System.Object got

The object which was used.

System.Boolean allowNil

True if nils were allowed in this call.

Returns
ScriptRuntimeException

The exception to be raised.

BadArgumentValueExpected(Int32, String)

Creates a ScriptRuntimeException with a predefined error message specifying that a function was called with no value when a value was required. This function creates a message like "bad argument #xxx to 'yyy' (value expected)" while BadArgumentNoValue(Int32, String, DataType) creates a message like "bad argument #xxx to 'yyy' (zzz expected, got no value)"

Declaration
public static ScriptRuntimeException BadArgumentValueExpected(int argNum, string funcName)
Parameters
System.Int32 argNum

The argument number (0-based).

System.String funcName

Name of the function generating this error.

Returns
ScriptRuntimeException

The exception to be raised.

CannotResumeNotSuspended(CoroutineState)

Creates a ScriptRuntimeException with a predefined error message specifying that an attempt resume a coroutine in an invalid state was done.

Declaration
public static ScriptRuntimeException CannotResumeNotSuspended(CoroutineState state)
Parameters
CoroutineState state

The state of the coroutine.

Returns
ScriptRuntimeException

The exception to be raised.

CannotYield()

Creates a ScriptRuntimeException with a predefined error message specifying that an attempt to yield across a CLR boundary was made.

Declaration
public static ScriptRuntimeException CannotYield()
Returns
ScriptRuntimeException

The exception to be raised.

CannotYieldMain()

Creates a ScriptRuntimeException with a predefined error message specifying that an attempt to yield from the main coroutine was made.

Declaration
public static ScriptRuntimeException CannotYieldMain()
Returns
ScriptRuntimeException

The exception to be raised.

CompareInvalidType(DynValue, DynValue)

Creates a ScriptRuntimeException with a predefined error message specifying that a comparison operator was applied on an invalid combination of operand types

Declaration
public static ScriptRuntimeException CompareInvalidType(DynValue l, DynValue r)
Parameters
DynValue l

The left operand.

DynValue r

The right operand.

Returns
ScriptRuntimeException

The exception to be raised.

ConcatOnNonString(DynValue, DynValue)

Creates a ScriptRuntimeException with a predefined error message specifying that a concat operation was attempted on non-strings

Declaration
public static ScriptRuntimeException ConcatOnNonString(DynValue l, DynValue r)
Parameters
DynValue l

The left operand.

DynValue r

The right operand.

Returns
ScriptRuntimeException

The exception to be raised.

Exceptions
InternalErrorException

If both are numbers or strings

ConvertObjectFailed(DataType)

Creates a ScriptRuntimeException with a predefined error message specifying that a conversion of a Lua type to a CLR type has failed.

Declaration
public static ScriptRuntimeException ConvertObjectFailed(DataType t)
Parameters
DataType t

The Lua type.

Returns
ScriptRuntimeException

The exception to be raised.

ConvertObjectFailed(DataType, Type)

Creates a ScriptRuntimeException with a predefined error message specifying that a constrained conversion of a Lua type to a CLR type has failed.

Declaration
public static ScriptRuntimeException ConvertObjectFailed(DataType t, Type t2)
Parameters
DataType t

The Lua type.

Type t2

The expected CLR type.

Returns
ScriptRuntimeException

The exception to be raised.

ConvertObjectFailed(Object)

Creates a ScriptRuntimeException with a predefined error message specifying that a conversion of a CLR type to a Lua type has failed.

Declaration
public static ScriptRuntimeException ConvertObjectFailed(object obj)
Parameters
System.Object obj

The object which could not be converted.

Returns
ScriptRuntimeException

The exception to be raised.

ConvertToNumberFailed(Int32)

Creates a ScriptRuntimeException with a predefined error message specifying that a conversion to number failed.

Declaration
public static ScriptRuntimeException ConvertToNumberFailed(int stage)
Parameters
System.Int32 stage

Selects the correct error message: 0 - "value must be a number" 1 - "'for' initial value must be a number" 2 - "'for' step must be a number" 3 - "'for' limit must be a number"

Returns
ScriptRuntimeException

The exception to be raised.

IndexType(DynValue)

Creates a ScriptRuntimeException with a predefined error message specifying that an invalid attempt to index the specified object was made

Declaration
public static ScriptRuntimeException IndexType(DynValue obj)
Parameters
DynValue obj

The object.

Returns
ScriptRuntimeException

The exception to be raised.

LenOnInvalidType(DynValue)

Creates a ScriptRuntimeException with a predefined error message specifying that a len operator was applied on an invalid operand

Declaration
public static ScriptRuntimeException LenOnInvalidType(DynValue r)
Parameters
DynValue r

The operand.

Returns
ScriptRuntimeException

The exception to be raised.

LoopInCall()

Creates a ScriptRuntimeException with a predefined error message specifying that a loop was detected when performing __call over metatables.

Declaration
public static ScriptRuntimeException LoopInCall()
Returns
ScriptRuntimeException

The exception to be raised.

LoopInIndex()

Creates a ScriptRuntimeException with a predefined error message specifying that a loop was detected when performing __index over metatables.

Declaration
public static ScriptRuntimeException LoopInIndex()
Returns
ScriptRuntimeException

The exception to be raised.

LoopInNewIndex()

Creates a ScriptRuntimeException with a predefined error message specifying that a loop was detected when performing __newindex over metatables.

Declaration
public static ScriptRuntimeException LoopInNewIndex()
Returns
ScriptRuntimeException

The exception to be raised.

Rethrow()

Rethrows this instance if

Declaration
public override void Rethrow()
Overrides
InterpreterException.Rethrow()

TableIndexIsNaN()

Creates a ScriptRuntimeException with a predefined error message specifying that a table indexing operation used a NaN as the key.

Declaration
public static ScriptRuntimeException TableIndexIsNaN()
Returns
ScriptRuntimeException

The exception to be raised.

TableIndexIsNil()

Creates a ScriptRuntimeException with a predefined error message specifying that a table indexing operation used nil as the key.

Declaration
public static ScriptRuntimeException TableIndexIsNil()
Returns
ScriptRuntimeException

The exception to be raised.

UserDataArgumentTypeMismatch(DataType, Type)

Creates a ScriptRuntimeException with a predefined error message specifying that a userdata of a specific CLR type was expected and a non-userdata type was passed.

Declaration
public static ScriptRuntimeException UserDataArgumentTypeMismatch(DataType t, Type clrType)
Parameters
DataType t

The Lua type.

Type clrType

The expected CLR type.

Returns
ScriptRuntimeException

The exception to be raised.

UserDataMissingField(String, String)

Creates a ScriptRuntimeException with a predefined error message specifying that an attempt to index an invalid member of a userdata was done.

Declaration
public static ScriptRuntimeException UserDataMissingField(string typename, string fieldname)
Parameters
System.String typename

The name of the userdata type.

System.String fieldname

The field name.

Returns
ScriptRuntimeException

The exception to be raised.

Back to top Built by Itinero, MIT licensed.