world.GetPluginVariableList

MUSHclient script function (Method) — introduced in version 3.23

Gets the list of variables in a specified plugin

Prototype

VARIANT GetPluginVariableList(BSTR PluginID);

Data type meanings

Description

Returns an array of all the variables currently defined for the nominated plugin. You can then use GetPluginVariable to get the value for each one.

If you want to find the list of variables in the current plugin, use "GetVariableList".

If you are writing a plugin and want to find the "global" MUSHclient variable list, use an empty plugin ID, eg.

vList = world.GetPluginVariableList ("")

VBscript example

dim varList

varList = world.GetPluginVariableList ("982581e59ab42844527eec80")

If Not IsEmpty (varList) Then

  For Each v In varList 
    world.note v & " = " &  world.GetPluginVariable ("982581e59ab42844527eec80", v)
  Next

End If

Jscript example

varList = new VBArray(world.GetPluginVariableList("982581e59ab42844527eec80")).toArray();

if (varList)  // if not empty
 for (i = 0; i < varList.length; i++)
   world.note(varList [i] + " = " + 
         world.GetPluginVariable("982581e59ab42844527eec80", varList [i]));

PerlScript example

foreach $item (Win32::OLE::in ($world->GetPluginVariableList ("982581e59ab42844527eec80")))
 {
 ($key, $value) = ($item, $world->GetPluginVariable ("982581e59ab42844527eec80", $item));
 $world->note($key . " = " . $value) if (defined ($key));
 }

Python example

variablelist = world.GetPluginVariableList("982581e59ab42844527eec80")
if (variablelist ):
  for v in variablelist : world.Note (v + " = " +
                  world.GetPluginVariable("982581e59ab42844527eec80", v))

Lua example

-- show all variables and their values

for k, v in pairs (GetPluginVariableList("982581e59ab42844527eec80")) do 
  Note (k, " = ", v) 
end

Lua notes

Under Lua this function returns a table of all variables and their values,
keyed by the variable name.

Thus you can directly access variables from the table, like this:

-- show value for variable "victim" in plugin ID "982581e59ab42844527eec80" ...

print (GetPluginVariableList("982581e59ab42844527eec80").victim)

Return value

If there are no variables then the return value is empty. Use "IsEmpty" to test for this possibility.

If the nominated plugin does not exist, then the return value is NULL. Use "IsNull" to test for this possibility.

Otherwise, it returns a variant array containing the names of all the variables in the specified plugin. Use "ubound" to find the number of variables in the list. You can then use "GetPluginVariable" to find details about each variable.

Related topic

Plugins

See also

FunctionDescription
GetVariableGets the contents of a variable
GetVariableListGets the list of variables