GetGlobalVarValues

Fetch a list of all global variable values

Signature

public List<GlobalVariableValue> GetGlobalVarValues(bool persisted = true)

Parameters

persisted
bool
Default:
True

To get, set, or unset persisted global variables, set to true or leave empty.

To get, set, or unset temporary/non-persisted global variables, set to false.

Return Type

List<Streamer.bot.Plugin.Interface.Model.GlobalVariableValue>

Example

using System;
using System.Collections.Generic;//due to List usage
public class CPHInline
{
  public bool Execute()
  {
    //Get list of global variable values
    List<GlobalVariableValue> globalVarList = CPH.GetGlobalVarValues(); 
    //Example writing variable names into logs
    foreach(GlobalVariableValue globalVar in globalVarList)
    {
      //Get name of current globalVar
      string varName = globalVar.VariableName;
      //Get last write DateTime of current globalVar
      DateTime lastWrite = globalVar.LastWrite;

      CPH.LogInfo($"GlobalVarName : {varName}, LastWrite: {lastWrite}");
    }
    return true;
  }
}