Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ErrorLevel as a parameter name causing error #233

Closed
Ragnar-F opened this issue Jan 30, 2018 · 1 comment
Closed

ErrorLevel as a parameter name causing error #233

Ragnar-F opened this issue Jan 30, 2018 · 1 comment

Comments

@Ragnar-F
Copy link
Collaborator

https://github.com/Lexikos/AutoHotkey_L-Docs/blob/c56ee890a2d77473945db31f7e00d9bf7d38a74a/docs/commands/Gui.htm#L286

just me has found out that ErrorLevel:="" causes the error "Illegal parameter name".

Should this be changed in the docs, or does the AutoHotkey code need to be modified to make it work this way? Actually, there's nothing wrong with using ErrorLevel as a parameter name.

@Lexikos
Copy link
Collaborator

Lexikos commented Jan 30, 2018

Nothing wrong with using ErrorLevel as a parameter name? It is illegal.

Built-in variables such as Clipboard, ErrorLevel, and A_TimeIdle are never local (they can be accessed from anywhere), and cannot be redeclared.

If you redeclared it as local (or as a parameter, which is the same thing), the function would not be able to check the actual ErrorLevel. Someone may expect commands to affect the local ErrorLevel, but it wouldn't work that way.

The documentation is intended to show that the fourth parameter receives the same value as ErrorLevel. In actual code, you should use a meaningful name. The meaning depends on the control or the script.

You may modify it if you wish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants