本文整理汇总了C#中DynValue.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# DynValue.Clone方法的具体用法?C# DynValue.Clone怎么用?C# DynValue.Clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DynValue
的用法示例。
在下文中一共展示了DynValue.Clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetIndex
public bool SetIndex(Script script, DynValue index, DynValue value, bool isDirectIndexing)
{
if (index.Type != DataType.String)
throw new ScriptRuntimeException("string property was expected");
lock (m_Lock)
{
switch (value.Type)
{
case DataType.Void:
case DataType.Nil:
m_Values.Remove(index.String);
return true;
case DataType.UserData:
// HERE YOU CAN CHOOSE A DIFFERENT POLICY.. AND TRY TO SHARE IF NEEDED. DANGEROUS, THOUGH.
throw new ScriptRuntimeException("Cannot share a value of type {0}", value.Type.ToErrorTypeString());
case DataType.ClrFunction:
// HERE YOU CAN CHOOSE A DIFFERENT POLICY.. AND TRY TO SHARE IF NEEDED. DANGEROUS, THOUGH.
throw new ScriptRuntimeException("Cannot share a value of type {0}", value.Type.ToErrorTypeString());
case DataType.Boolean:
case DataType.Number:
case DataType.String:
m_Values[index.String] = value.Clone();
return true;
case DataType.Function:
case DataType.Table:
case DataType.Tuple:
case DataType.Thread:
case DataType.TailCallRequest:
case DataType.YieldRequest:
default:
throw new ScriptRuntimeException("Cannot share a value of type {0}", value.Type.ToErrorTypeString());
}
}
}