module("EseGroup", package.seeall) -- Behavior function SeekByTime(selfID, strm) -- Get the time in the parameter. local dblValue = strm:GetFloat64(); BehaviorAPI.LogMessage(0,dblValue,true) -- Set the given time as the TimeCursor; BehaviorAPI.SetProperty(selfID, "TimeCursor",dblValue) end -- Behavior function SeekByLabel(selfID, strm) -- Get the label in the parameter and process it so it can be compared. local strLabel = strm:GetString(); strLabel = string.lower(strLabel); strLabel = string.gsub(strLabel," ","_"); local dblValue = nil; -- Loop through all the pairs in the Labels Map. local result, keys = BehaviorAPI.FindPropertyKeys(selfID, "Labels") for i, key in pairs(keys) do local dblCurrentValue = BehaviorAPI.GetProperty(selfID, "Labels", key) -- Process the key so it can be compared. key = string.lower(key); key = string.gsub(key," ","_"); -- If the key matched the given label, keep the value and break; if key == strLabel then dblValue = dblCurrentValue; --break; end end -- If the value is defined. if dblValue ~= nil then -- Set it as the current TimeCursor. BehaviorAPI.SetProperty(selfID, "TimeCursor",dblValue) else BehaviorAPI.LogMessage(0,"No label found in the group for given parameter : " .. strLabel,true) end end