All local at bottom of script

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

All local at bottom of script

Post by poudenes »

Hi There,

I tried but didn't work. Is there a way to put all the local variables at the bottom of a script.
So i see the script instead of scrolling down to edit?
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
BakSeeDaa
Posts: 485
Joined: Thursday 17 September 2015 10:13
Target OS: Raspberry Pi / ODroid
Domoticz version:

Re: All local at bottom of script

Post by BakSeeDaa »

Doing what you described would change the scope of the variable and will probably change how it works.

Code: Select all

myVar = 123 -- Assign 123 to a global variable

local myVar  --  Define a new different variable (a local scope variable) using the same name

myVar = 123 -- 123 will be assigned to the local variable myVar from now on.
It's all about the variables scope. You can read about it.. This has nothing to do with dzVents, it's pure Lua.

So don't change your scripts like that. ;)
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: All local at bottom of script

Post by poudenes »

thanks :)
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest