import crafttweaker.data.IData;
val myFirstMap as IData = {key1: "value1",
key2: "value2",
key3: 3};
val nestedMap as IData = { key1:
{
key1: "hello"
}
};
val mySecondMap as IData = {key1: "value1",
key2: "value2",
key3: 3};
// 检索叫做 "key1" 的成员
var k1 as IData = mySecondMap.key1;
print(k1.asString());
// 检索叫做 "key2" 的成员
var k2 as IData = mySecondMap.memberGet("key2");
print(k2.asString());
val map1 as IData = {
key1 : "hello",
key3 : "test",
};
val map2 as IData = {
key2 : "bye",
key3 : "override"
};
print((map1 + map2).asString()); // 打印出 {key1 : "hello", key2 : "bye", key3 : "override"}
val map3 as IData = {
key1 : "two",
key2 : "two",
key3 : "three"
};
print((map3 - "key1").asString()); // 打印出 {key2 : "two", key3 : "three"}
val map4 as IData = {
key3 : "anything"
};
print((map3 - map4).asString()); // 打印出 {key1 : "two", key2 : "two"}
val map3 as IData = {
key1 : "two",
key2 : "two",
key3 : "three"
};
print(map3 has "key1"); // true
print(map3 has "key4"); // false