Exemplo n.º 1
0
        private UvmMap <object> jsonToMap(JObject jobj)
        {
            if (jobj == null)
            {
                return(null);
            }
            else
            {
                var result = UvmMap <object> .Create();

                foreach (var p in jobj)
                {
                    var    item  = p.Value;
                    object value = null;
                    if (item == null)
                    {
                        value = null;
                    }
                    else if (item is JObject && item.ToString().StartsWith("{"))
                    {
                        value = jsonToMap(item as JObject);
                    }
                    else if (item is JObject && item.ToString().StartsWith("["))
                    {
                        value = jsonToArray(item as JObject);
                    }
                    else
                    {
                        value = item;
                    }
                    result.Set(p.Key, value);
                }
                return(result);
            }
        }
Exemplo n.º 2
0
 // getmetatable
 public static UvmMap <object> getmetatable(UvmTable table)
 {
     return(UvmMap <object> .Create()); // TODO: 模拟metatable
 }