Library of Functions


Description


Changes the value of a global variable.

Usage and Arguments


fibaro:setGlobal(varName, value)

  • varName: The name of the global variable.
  • value: The new value of the global variable.

Returned Values


None.

Examples


-- Assign the value 1 to the global variable named 'index'
fibaro:setGlobal('index', 1)
 
-- Increase the value of the global variable 'test' by 3
fibaro:setGlobal('test', fibaro:getGlobalValue('test') + 3)
 
-- Assign the value of the local variable 'a'
-- to the global variable 'index'
local a = 10 * 234
fibaro:setGlobal('index', a)

Extended Description


The function fibaro:setGlobal can be used only for global variables that are not read-only variables. If you try to overwrite a read-only variable, a read-only warning is generated and the operation is not performed.