RomAnT wrote: ↑27 Sep 2021, 06:07
This works when defied in main code
Code: Select all
mess() {
msgbox "Hello World!"
}
outFunc() {
inFunc(myStr) {
%myStr%()
}
myVar := "mess"
inFunc(myVar)
}
When definition made inside shortcut same code gives error
Code: Select all
^R:: {
mess() {
msgbox "Hello World!"
}
outFunc() {
inFunc(myStr) {
%myStr%() ; <--- Error: Variable not found. Specifically: mess
}
myVar := "mess"
inFunc(myVar)
}
}
example 1, %"mess"% be resolved to
mess (global var).
example 2,
inFunc is not a closure function, so %"mess"% be resolved to
mess (global var) too.
Code: Select all
^R:: {
mess() {
msgbox "Hello World!"
}
outFunc() {
inFunc(myStr) {
(mess)
%myStr%() ; <--- Error: Variable not found. Specifically: mess
}
myVar := "mess"
inFunc(myVar)
}
outFunc()
}
example 3,
inFunc is a closure function, and local vars has var that named "mess", so %"mess"% will be resolved to
mess (local var).