示例#1
0
        /// <summary>
        /// Returns a string which is what it's expected to be output by debuggers.
        /// </summary>
        public string ToDebugPrintString()
        {
            if (this.m_Object != null && this.m_Object is RefIdObject)
            {
                RefIdObject refid = (RefIdObject)m_Object;

                string typeString = this.Type.ToLuaTypeString();

                if (m_Object is IUserData)
                {
                    IUserData ud  = (IUserData)m_Object;
                    string    str = ud.AsString();
                    if (str != null)
                    {
                        return(str);
                    }
                }
                return(refid.FormatTypeString(typeString));
            }

            switch (Type)
            {
            case DataType.Tuple:
                return(string.Join("\t", Tuple.Select(t => t.ToPrintString()).ToArray()));

            case DataType.TailCallRequest:
                return("(TailCallRequest)");

            case DataType.YieldRequest:
                return("(YieldRequest)");

            default:
                return(ToString());
            }
        }
 /// <inheritdoc/>
 public string AsString(IUserData obj)
 {
     return(obj.AsString());
 }
示例#3
0
 /// <summary>
 /// Converts this userdata to string
 /// </summary>
 /// <param name="obj">The object.</param>
 /// <returns></returns>
 public string AsString(IUserData obj)
 {
     return(obj == null ? null : obj.AsString());
 }
示例#4
0
 /// <summary>
 /// Converts this userdata to string
 /// </summary>
 /// <param name="obj">The object.</param>
 /// <returns></returns>
 public virtual string AsString(IUserData obj)
 {
     return((obj != null) ? obj.AsString() : null);
 }