[Bug] Functions inner Functions variables Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
rodemp
Posts: 44
Joined: 15 Nov 2016, 00:28

[Bug] Functions inner Functions variables

Post by rodemp » 10 Apr 2019, 02:04

Code: Select all

aa()

aa()
{
	a:="outvar"
	bb()
	
	bb()
	{
		b:="a"
		MsgBox %b% ; print not thing
	}
}

Code: Select all

aa()

aa()
{
	a:="outvar"
	bb()
	
	bb()
	{
		b:="a"
		MsgBox a ; outvar
		MsgBox %b% ; outvar
	}
}
Can not get a variable called by %name% unless it is called from an inner functions
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: [Bug] Functions inner Functions variables  Topic is solved

Post by Helgef » 10 Apr 2019, 02:18

This is documented behaviour.
Dynamic variable references inside a nested function can resolve to variables from the outer function only if the nested function (or one of its own nested functions) also contains a non-dynamic reference to the variable.
Post Reply

Return to “Ask for Help (v2)”