GetVariable
Script function world.GetVariable Read about scripting Type Method Summary Gets the contents of a variable Prototype `VARIANT GetVariable(BSTR VariableName);` View list of data type meanings Description `Gets the contents of the named variable. If the named variable does not exist, EMPTY is returned. If the name given is invalid, NULL is returned. (Use "IsEmpty" and "IsNull" to test for these possibilities). If GetVariable is called from within a plugin, the variables for the current plugin are used, not the "global" MUSHclient variables. If you want to find the value of a variable in another plugin, or the global MUSHclient variables, use "GetPluginVariable".` VBscript example
    dim MyName

    MyName = world.GetVariable ("MyName")

    if isempty (MyName) then
      world.note "My name is not defined"
    end if

    if isnull (MyName) then
      world.note "Invalid variable name"
    end if

    world.note MyName
Jscript example
    var MyName;

    MyName = world.GetVariable("MyName");

    if (MyName == null)
      world.note("MyName is not defined");
    else
      world.note(MyName);
PerlScript example
    $MyName = $world->GetVariable("MyName");

    if (!defined ($MyName))
      {
      $world->note ("MyName is not defined");
      }
    else
      {
      $world->note ($MyName);
      }
Python example
    MyName = world.GetVariable("MyName")

    if not MyName:
      world.note("MyName is not defined")
    else:
      world.note(MyName)
Lua example
    local MyName

    MyName = GetVariable("MyName")

    if MyName == nil then
      Note ("MyName is not defined")
    else
      Note (MyName)
    end
Lua notes
    Lua returns nil where applicable instead of an "empty variant" or "null variant".
Return value
    The contents of the specified variable.
    An EMPTY variant, if the variable does not exist.
    A NULL variant if the variable name is invalid.
See Also ... Topics Arrays Plugins Scripting Variables Functions DeleteVariable (Deletes a variable) GetEntity (Retrieves the value of an MXP server-defined entity) GetPluginVariable (Gets the contents of a variable belonging to a plugin) GetPluginVariableList (Gets the list of variables in a specified plugin) GetVariableList (Gets the list of variables) SetVariable (Sets the value of a variable) (Help topic: function=GetVariable) Documentation contents page