Local variable incorrectly shown as global.

For loop iterator variables in LUA are local to the for loop.

The Glider IDE highlights these in GREEN, as they would a GLOBAL variable.

They should be regular BLACK like local variables.

In the following example the IDE shows the variable “i” as being global.

for i=1,10 do print(i) end

@Prographodeveloper,

Thank you for reporting this. Unfortunately we cannot replicate the problem in a simple project. There may be something more complicated going on in your project. Is this something that happens frequently for other symbols as well?

Regards,

M.Y. Developers

No, it is very rare. Perhaps the editor gets in a confused state. I have found that exiting the editor and restarting clears the problem.

@Prographodeveloper,

Interesting, thanks for letting us know. We will take a look at this issue and see what is going on. Thank you again for reporting it.

Regards,

M.Y. Developers 

I also run across this issue. Globals sometimes recognized as locals and reverse. This is really a strange error and not always reproducible.

Just one example:

local arr = {} arr[#arr+1] = {} arr[#arr].x1 = {} -- x1 recognized as global

One more example with two files:

-- main.lua \_myGlobal = "huhu" -- \_myGlobal recognized as global -- test.lua local str = \_myGlobal -- \_myGlobal not recognized as global

My current approach is to mark every global with an prefix as showed above (what is generally a good idea), but this is an annoying bug anyway.

Thanks,

Mike

ok, I’m sorry. I just saw, during I tried to change the color for globals in preferences to black, that green means field instead of global. That’s also weird, because not all fields (what means array I guess) were green. Anyway, by selecting black for fields in preferences/f&c/syntax/lua there are no confusing green variables any more  :wink:

But is there a way to highlight globals tough? Changing the color in the “mod-global” setting makes absolutely no difference :huh: .

Thanks,

Mike

@sunmils,

Thank you for letting us know. Regarding the color, please go to tools->options-> fonts&colors->syntax->lua-> and please select “mod-field”. Sorry about this, we will fix the name. You can highlight by setting the background to a different color. Green should mean global, could you give a code example that is displaying incorrectly so we can check it out. 

Thanks,

M.Y. Developers

@Prographodeveloper,

Thank you for reporting this. Unfortunately we cannot replicate the problem in a simple project. There may be something more complicated going on in your project. Is this something that happens frequently for other symbols as well?

Regards,

M.Y. Developers

No, it is very rare. Perhaps the editor gets in a confused state. I have found that exiting the editor and restarting clears the problem.

@Prographodeveloper,

Interesting, thanks for letting us know. We will take a look at this issue and see what is going on. Thank you again for reporting it.

Regards,

M.Y. Developers 

I also run across this issue. Globals sometimes recognized as locals and reverse. This is really a strange error and not always reproducible.

Just one example:

local arr = {} arr[#arr+1] = {} arr[#arr].x1 = {} -- x1 recognized as global

One more example with two files:

-- main.lua \_myGlobal = "huhu" -- \_myGlobal recognized as global -- test.lua local str = \_myGlobal -- \_myGlobal not recognized as global

My current approach is to mark every global with an prefix as showed above (what is generally a good idea), but this is an annoying bug anyway.

Thanks,

Mike

ok, I’m sorry. I just saw, during I tried to change the color for globals in preferences to black, that green means field instead of global. That’s also weird, because not all fields (what means array I guess) were green. Anyway, by selecting black for fields in preferences/f&c/syntax/lua there are no confusing green variables any more  :wink:

But is there a way to highlight globals tough? Changing the color in the “mod-global” setting makes absolutely no difference :huh: .

Thanks,

Mike

@sunmils,

Thank you for letting us know. Regarding the color, please go to tools->options-> fonts&colors->syntax->lua-> and please select “mod-field”. Sorry about this, we will fix the name. You can highlight by setting the background to a different color. Green should mean global, could you give a code example that is displaying incorrectly so we can check it out. 

Thanks,

M.Y. Developers