ahk[Post]Function parameters bug

Post AHK_H specific scripts & libraries and discuss the usage and development of HotKeyIt's fork/branch
User avatar
Masonjar13
Posts: 1388
Joined: 20 Jul 2014, 10:16
GitHub: Masonjar13
Location: Не Россия

ahk[Post]Function parameters bug

24 Aug 2018, 10:20

I didn't thoroughly check the forums, but I didn't see anything about it in the _H forum anyway. Originally, I had tried sending varadic parameters via DllCall, which didn't work, and I'm assuming there's not a way to get that working. But, I just noticed that you can't use ahkPostFunction on a function that uses a varadic parameter. I tried and it crashed. So then I compromised and tried using something like func(var,o1:="",o2=""). That also doesn't work; say if you send it 2 parameters, the third (o2) will contain "Str". If you leave two optional parameters blank, it will crash. I finally settled for func(var,o1,2) and just sent blank/empty variables when they weren't needed.

My question is: is this unavoidable? Could varadic/optional function parameters possibly work?
HotKeyIt
Posts: 1686
Joined: 29 Sep 2013, 18:35
Contact:

Re: ahk[Post]Function parameters bug

24 Aug 2018, 12:54

Unfortunately not.
However you can share function objects to call the function:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

User avatar
Masonjar13
Posts: 1388
Joined: 20 Jul 2014, 10:16
GitHub: Masonjar13
Location: Не Россия

Re: ahk[Post]Function parameters bug

24 Aug 2018, 13:55

That's what I thought. Though, what you suggested is pretty much perfect for my use case, so I'll try doing that. Thank you!

Return to “AutoHotkey_H”

Who is online

Users browsing this forum: No registered users and 0 guests