Inside function node's code the general lua rules apply: https://www.lua.org/pil/4.2.html
In LuvitRED there is an additional way to use global or flow wide variables. Using this method a variable can be accessed from within every function node.
By using the prefix global, the variable will be stored in RAM with the key following the prefix (separated by a . ). This method is identical to using the 'global store' node to store a variable to RAM, and both can be used together.
example:
function block 1 global.variable = msg.payload return function block 2 if global.variable ~= nil then msg.payload = global.variable return msg
The attached flow demonstrates the use of the multiple ways to store/retrieve variables in LuvitRED.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article