Page MenuHomeFeedback Tracker

[Feature Request] New script command: directCall
Closed, ResolvedPublic

Description

Code executed via call in a scheduled scope is still scheduled, but in some circumstances it would be beneficial to be able to force it to run code unscheduled, such as in functions that require it to be run unscheduled where it could be used as

if (canSuspend) exitWith {
  _this directCall this_fnc;
};

This is currently possible to do via apply which CBA uses for CBA_fnc_directCall,

Examples:
    (begin example)
        0 spawn { {systemChat str canSuspend} call CBA_fnc_directCall; };
        -> false
    (end)

params [["_CBA_code", {}, [{}]], ["_this", []]];

private "_CBA_return";

isNil {
    // Wrap the _CBA_code in an extra call block to prevent problems with exitWith and apply
    _CBA_return = ([_x] apply {call _CBA_code}) select 0;
};

if (!isNil "_CBA_return") then {_CBA_return};

however it would be better to have a properly supported solution rather than a hack like this.

Details

Severity
Feature
Resolution
Won't Fix
Reproducibility
N/A
Operating System
Windows 7
Category
Scripting

Event Timeline

dedmen added a subscriber: dedmen.Dec 15 2020, 1:13 PM

just use isNil.

This is currently possible to do via apply

no its not, apply got nothing to do with that. isNil executes code in unscheduled.

What you want is

if (canSuspend) exitWith {
  isNil this_fnc;
};
dedmen closed this task as Resolved.Dec 15 2020, 1:13 PM
dedmen changed Resolution from Open to Won't Fix.