BoundFunc Cannot Be Used Directly As Function Parameter?

Report problems with documented functionality
egocarib
Posts: 100
Joined: 21 May 2015, 18:21

BoundFunc Cannot Be Used Directly As Function Parameter?

20 Oct 2017, 09:38

I couldn't find anything in the docs about this.

This works as expected:

Code: Select all

fn := Func("FnA").Bind(0)
Hotkey("NumpadAdd", fn)
Return

FnA(num := 0)
{
	MsgBox(num)
}
This throws an error (the error varies between v1 and v2, but it's present in every version I tested)

Code: Select all

Hotkey("NumpadAdd", Func("FnA").Bind(0))
Return

FnA(num := 0)
{
	MsgBox(num)
}
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: BoundFunc Cannot Be Used Directly As Function Parameter?

20 Oct 2017, 10:19

Hotkey - label wrote:If not a valid label name, this parameter can be the name of a function, or a single variable reference containing a function object. For example, Hotkey(funcobj, "On"). Other expressions which return objects are currently unsupported.
(my bold)
source
egocarib
Posts: 100
Joined: 21 May 2015, 18:21

Re: BoundFunc Cannot Be Used Directly As Function Parameter?

20 Oct 2017, 10:33

Ah, I missed that detail. :think: Thanks, Helgef.
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: BoundFunc Cannot Be Used Directly As Function Parameter?

20 Oct 2017, 11:39

Np, for your reference, settimer has the same limitation.

Cheers.
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: BoundFunc Cannot Be Used Directly As Function Parameter?

01 Jan 2018, 11:55

Hello egocarib, this has now been fixed in v2 :thumbup:. Hence, this is fine,

Code: Select all

Hotkey("a", Func("FnA").Bind(0))
Also fixed for settimer. See AutoHotkey v2 alpha (UPDATES).

Cheers.

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 26 guests