I now trying to migrate from LDT to VScode and see some tips from the new editor about lua syntaxis (I use Lua Diagnostics extension). I have not seen such tips before, so that's why I'm here.
The question may seem insignificant, but for me, it is important to understand this part of the syntax in my examples. I also want to check how correct the editor is.
local a, b, c, d -- All variables are local local a=0 b=0 c=0 d=0 -- Editor says: "Global variable b,c,d in lowercase initial."
But if write:
local a=0 local b=0 local c=0 local d=0 -- All variables go local too
So there is no way to initialize variables with values (I use much of pre-set variables) without posting "local" every time before them? I mean one "local" for line...
Also syntax like:
local a=0, b=0, c=0, d=0 local a=0, local b=0, local c=0, local d=0
Showing an issues: DIAG_OVER_MAX_VALUES and the simulator gives me "unexpected symbol near "=" So it looks like a complete wrong declaration.
local a,b -- Editor says: "Unused local a and b" local function test (a,b) --function content end
It looks like variable's a,b, that declared in a "local function test", are also local. But if I will not declare it for "return":
local function test () --function content return a,b -- Editor says: "Global variable b,c,d in lowercase initial." end
The a and b will be global.
So if I understand correctly, only variables that declared in () go local?