Any time I try accessing a global variable from an AutoHotkey function with #warn enabled, I'm shown a warning prompt saying my local variable has the same name as a global variable.
This warning only seems to affect functions. Accessing the variable from a hotstring doesn’t raise any warnings.
#Warn
myString := "Hello, world!"
DisplayString() {
MsgBox %myString% ; Warning: local variable
}
^j::
MsgBox, %myString% ; Perfectly valid!
Return
Why can't I access global variables from a function when warnings are enabled?