gamecircle.Whispersync.CurrentDataMapContainsChild

类型 函数
gamecircle.*
返回值 布尔值
版本 发行版 2024.3703
关键字 Whispersync、GameData、包含

概览

如果给定的键对应于当前 GameData 对象的子对象,则返回 true。否则,返回 false。

语法

gamecircle.Whispersync.CurrentDataMapContainsChild(key)
key (必需)

字符串. 我们希望检查作为当前 GameData 子对象是否存在的游戏数据的名称

示例

local gamecircle = require("plugin.gamecircle")  
gamecircle.Init(false, false, true)  
gamecircle.Whispersync.GameDataStepDownTo("Level 1")  
print("Level 1 Path: " .. gamecircle.Whispersync.CurrentDataMapGetPath())  
gamecircle.Whispersync.GameDataStepDownTo("Treasures")  
gamecircle.Whispersync.GameDataStepUp()  
gamecircle.Whispersync.GameDataStepDownTo("Secrets")  
print("Secrets Path: " .. gamecircle.Whispersync.CurrentDataGetPath())  
gamecircle.Whispersync.GameDataStepUp()  
print("Level 1 Children: ")  
local keys = gamecircle.Whispersync.CurrentDataMapChildKeys()  
for i,key in ipairs(keys)  
    print("-" .. key)  
end  
gamecircle.Whispersync.GameDataReturnToRoot()