Sadly I have encountered a problem that does not seem easy to solve towards me.
In my library I have to use the Random Command/Function to do something.
It is absolutely required and there is no way around (while I can just ignore v2 completely in my library)
It is possible to add code for v2 that does not cause issues when run under AHK v1.
Same can't be said for AHK v2. AHK v2s aggressive error checking finds that I pass too many parameters to the Random function:
Code: Select all
if isFunc("Random") {
var := Random(min, max)
} else {
Random var, min, max
}
The next best solution is 2 different versions for v2 and v1 however Id rather neglect v2 compatability.
I also thought about using #Include with an A_ variable that is different for v1 and v2 like A_AhkVersion.
Then I would have to change the name of said include for each minor AHK version and add a special include for each version (not a good idea).
My last thought was about using a built in variable thats present in v2 and not v1 or vice-versa.
But as it turns out there is not a single AHK variable that matches my criterias and also has a defined static value at startup.
So my question is if any of you know how to make this possible.