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

handle returned assignments in key events #1214

Merged
merged 1 commit into from
Aug 23, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addons/events/fnc_keyHandlerDown.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private _blockInput = false;
_params pushBack + _keybindParams;
_params pushBack _x;

_blockInput = ([_params call _code] param [0, false] isEqualTo true) || {_blockInput};
_blockInput = ([nil] apply {_params call _code} param [0, false] isEqualTo true) || {_blockInput};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 would be faster than nil but would ofc define _x, doubt that would break anyones code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_x previously leaked into the user's code block alongside all the other locals like _params, _code and _keybindParams etc.
One could also use [_x] I suppose to keep the _x the same.
I just don't care about micro optimizations like that. The code is still a fifth of what it used to be before my rewrite and no one ever complained about it.
_x being nil was just the logical thing, as in "this variable I never defined is undefined", from the users perspective.

};
};
} forEach (GVAR(keyDownStates) param [_inputKey, []]);
Expand Down