[v2] local inner function in global outer function
Posted: 13 Feb 2023, 11:59
Is it possible to have a local inner function in a global outer function?
That would be nice to get a kind of private inner function in a global function.
As far as I know this isn't possible, so I post it here as a wish.
My example:
In the code above the function TrayMenuHandler is only needed locally, so I wish it is a local inner function.
But as inner function the variable err is global and I don't want that.
Also, I don't want to have to init every variable with its own global.
Cheers
That would be nice to get a kind of private inner function in a global function.
As far as I know this isn't possible, so I post it here as a wish.
My example:
Code: Select all
Init() {
global
var1 := 1
var2 := 2
(...)
A_TrayMenu.Add "&Something", TrayMenuHandler
TrayMenuHandler() {
try {
(...)
} catch as err {
(...)
}
}
}
But as inner function the variable err is global and I don't want that.
Also, I don't want to have to init every variable with its own global.
Cheers