ds_map_exists

如果指定的密钥存在于(先前创建的)DS映射中,则此函数将返回true;如果不存在,则返回false

 

语法:

ds_map_exists(id, key);

参数类型描述
idDS Map要检查的数据结构的ID
keyString要检查的密钥

 

返回:

Boolean

 

例子:

if (!ds_map_exists(inventory, "potions"))
{
    ds_map_add(inventory, "potions", 1);
}

上述代码将检查变量 "inventory" 中索引的 DS 映射中的键 "potions",如果它不存在,则将其添加到映射中。