public static bool remove(LuaMap map, object key) { if (key != null) { return(map.map.Remove(key)); } return(false); }
public static LuaMap merge(LuaMap map1, LuaMap map2, Func <object, object, LuaResult> func) { Dictionary <object, object> map = new Dictionary <object, object>(map1.map); foreach (KeyValuePair <object, object> entry in map2.map) { if (func != null) { object value; if (map.TryGetValue(entry.Key, out value)) { LuaResult res = func(value, entry.Value); map[entry.Key] = res[0]; continue; } } map[entry.Key] = entry.Value; } return(new LuaMap(map)); }
public static LuaMap diff(LuaMap map1, LuaMap map2) { Dictionary <object, object> map = new Dictionary <object, object>(map1.map.Count + map2.map.Count); foreach (KeyValuePair <object, object> entry in map1.map) { if (!map2.map.ContainsKey(entry.Key)) { map[entry.Key] = entry.Value; } } foreach (KeyValuePair <object, object> entry in map2.map) { if (!map1.map.ContainsKey(entry.Key)) { map[entry.Key] = entry.Value; } } return(new LuaMap(map)); }
public static LuaMap diff(LuaMap map1, LuaMap map2) { Dictionary<object, object> map = new Dictionary<object, object>(map1.map.Count + map2.map.Count); foreach (KeyValuePair<object, object> entry in map1.map) { if (!map2.map.ContainsKey(entry.Key)) { map[entry.Key] = entry.Value; } } foreach (KeyValuePair<object, object> entry in map2.map) { if (!map1.map.ContainsKey(entry.Key)) { map[entry.Key] = entry.Value; } } return new LuaMap(map); }
public static LuaMap clone(LuaMap map) { return(new LuaMap(new Dictionary <object, object>(map.map))); }
public static int size(LuaMap map) { return(map.map.Count); }
public static Func <object> values(LuaMap map) { LuaMapIterator iter = new LuaMapIterator(map.map.GetEnumerator()); return(new Func <object>(iter.NextValue)); }
public static Func <object[]> pairs(LuaMap map) { LuaMapIterator iter = new LuaMapIterator(map.map.GetEnumerator()); return(new Func <object[]>(iter.NextPair)); }
public static LuaMap merge(LuaMap map1, LuaMap map2, Func<object, object, LuaResult> func) { Dictionary<object, object> map = new Dictionary<object, object>(map1.map); foreach (KeyValuePair<object, object> entry in map2.map) { if (func != null) { object value; if (map.TryGetValue(entry.Key, out value)) { LuaResult res = func(value, entry.Value); map[entry.Key] = res[0]; continue; } } map[entry.Key] = entry.Value; } return new LuaMap(map); }
public static Func<object> keys(LuaMap map) { LuaMapIterator iter = new LuaMapIterator(map.map.GetEnumerator()); return new Func<object>(iter.NextKey); }
public static LuaMap clone(LuaMap map) { return new LuaMap(new Dictionary<object,object>(map.map)); }
public static int size(LuaMap map) { return map.map.Count; }
public static bool remove(LuaMap map, object key) { if (key != null) { return map.map.Remove(key); } return false; }
public static Func<object[]> pairs(LuaMap map) { LuaMapIterator iter = new LuaMapIterator(map.map.GetEnumerator()); return new Func<object[]>(iter.NextPair); }