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

Use unique local variable names in CBA_fnc_directCall #391

Merged
merged 1 commit into from
Jun 23, 2016

Conversation

commy2
Copy link
Contributor

@commy2 commy2 commented Jun 22, 2016

_code, _return and _arguments are common local variable names. This has the problem of these variables potentially overwriting other local variables from the parent scope of where CBA_fnc_directCall was executed from.

Example:

private _arguments = [1,2,3];

{
    systemChat str _arguments; // expected: [1,2,3], got: []
} call CBA_fnc_directCall;

All other* local variables carry over just fine. By tagging these local variables, we can make this function more flexible without having to pass every local variable as argument.

  • exception is _x which is overwritten by configClasses. I could restore _x too by adding another dummy variable as placeholder, but that requires some additional tricks with param (because the game would error if you reference an undefined _x variable in scheduled env.), so I think it's not worth it.

@commy2 commy2 added this to the 2.4.2 milestone Jun 23, 2016
@Killswitch00 Killswitch00 merged commit 3177bc5 into master Jun 23, 2016
@Killswitch00 Killswitch00 deleted the unique-variable-names-direct-call branch June 23, 2016 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants