Skip to content

DelVar(handle, string)

The DelVar Lua function deletes a specific variable in a set of variables. To learn more about the variables in plugins, have a look at the Variable Functions topic.

  • Handle:
    The handle of variable set.
  • String:
    The name of the variable. It needs to be in quotation marks.
  • Boolean:

    • True / 1: The variable was deleted.
    • False / 0: The variable was not deleted.

If the variable does not exist, then false is also returned.

This example deletes a variable called “myUserVar” in the set of user variables.

Copy CodeLua
```
return function()
-- Deletes the variable called 'myUserVar' in the 'UserVars' variable set.
local success = DelVar(UserVars(), "myUserVar")
-- Prints the outcome of the deletion outcome.
if success then
Printf("Variable is deleted.")
else
Printf("Variable is NOT deleted!")
end

end