Exemplo n.º 1
0
 public override int GetHashCode()
 {
     if (ValueType == LuaValueType.Number)
     {
         return(NumberVal.GetHashCode());
     }
     return(HashCode.Combine(Number, Object));
 }
Exemplo n.º 2
0
        public override string ToString()
        {
            switch (Type)
            {
            case VMSpecializationType.Nil:
                return("nil");

            case VMSpecializationType.Bool:
                return(BoolVal ? "true" : "false");

            case VMSpecializationType.Int:
                return($"{NumberVal} (int)");

            case VMSpecializationType.Double:
                return(NumberVal.ToString());

            case VMSpecializationType.LClosure:
                return($"[LClosure:0x{Object?.GetHashCode() ?? 0:X8}]");

            case VMSpecializationType.NClosure:
                return($"[NClosure/{Object?.GetType().Name ?? "null"}:0x{Object?.GetHashCode() ?? 0:X8}]");

            case VMSpecializationType.Table:
                return($"[Table:0x{Object?.GetHashCode() ?? 0:X8}]");

            case VMSpecializationType.Thread:
                return($"[Thread:0x{Object?.GetHashCode() ?? 0:X8}]");

            case VMSpecializationType.UserData:
                return($"[UserData:0x{Object?.GetHashCode() ?? 0:X8}]");

            case VMSpecializationType.String:
                return(StringVal.ToString());

            default: return($"[Unknown/{Type}:{Object?.GetType().Name ?? "null"}]");
            }
        }