canSuspend: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Some wiki formatting) |
Lou Montana (talk | contribs) m (Fix the fix) |
||
Line 33: | Line 33: | ||
private _sleepingCode = | private _sleepingCode = | ||
{ | { | ||
if (!canSuspend) exitWith { _this spawn | if (!canSuspend) exitWith { _this spawn _sleepingCode }; | ||
sleep _this; | sleep _this; | ||
hint ("slept " + str _this); | hint ("slept " + str _this); |
Latest revision as of 21:47, 17 March 2024
Description
- Description:
- Returns true if sleep, uiSleep or waitUntil commands can be used in the current scope. Usually when suspension is not allowed but used, for example when code is executed in unscheduled environment, the script engine would ignore any suspension command and throw error: "Suspending not allowed in this context". Using canSuspend command allows to detect the correct environment for the code.
- Groups:
- Program Flow
Syntax
- Syntax:
- canSuspend
- Return Value:
- Boolean
Examples
- Example 1:
- onEachFrame { systemChat str canSuspend; // false 0 spawn { hint str canSuspend }; // true onEachFrame {}; };
- Example 2:
- Make sure the function code is always spawned even when called:
Additional Information
- See also:
- sleep uiSleep waitUntil call spawn execVM isRemoteExecuted isRemoteExecutedJIP remoteExecutedOwner isUIContext isGamePaused isGameFocused
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note