You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When for-loop is located at root level of the file, it's variables from initializer are global
But when I add any level (empty brackets or a function) they're being local
// Uncomment brackets to make `val` local// {for(letval=0;val<2;++val)print(val);print('For loop end')// Should be nil, but indeed it prints "2"print(val)// }
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]doval=0-- here "local" keyword missing iswhileval<2doprint(val)
val=val+1endendprint("For loop end")
print(val)
The text was updated successfully, but these errors were encountered:
You can avoid this with noImplicitGlobalVariables, but that should only turn globals into locals, I think your original bug report is valid, this is not the behaviour I expect.
When for-loop is located at root level of the file, it's variables from initializer are global
But when I add any level (empty brackets or a function) they're being local
Example:
The text was updated successfully, but these errors were encountered: