Page MenuHomeFeedback Tracker

BIS_fnc_addStackedEventHandler uses format to compile a new code, thus fails with long codes
Feedback, NormalPublic

Description

The buffer of format is only 8 KB long thus the following part of the function will fail if the code is too long:

_code = compile format
[
    "%1%2%3 call %4",
     _nativeParamsString,
    ["", "_this + "] select (_event in EVENTS_WITH_PARAMS),
    ["(missionNamespace getVariable format ['BIS_stackedEventHandlers_" + _event + "_%1', _thisEventHandler])", []] select (_args isEqualTo []),
    _code
];

See the steps to repro for sample code

Details

Severity
Minor
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
Scripting
Steps To Reproduce

The following code creates a long string and compiles it into a code for BIS_fnc_addStackedEventHandler. It should show an icon, but the code fails:

_str = [""""];
for "_i" from 1 to 8192 do {
    _str pushBack "A";
};

_str pushBack """;drawIcon3D ['', [1,0,0,1], player modelToWorld [0,1,1], 0, 0, 0, 'Icon'];";
_str = _str joinString "";

_code = compile _str;

["TestDraw", "onEachFrame", _code] call BIS_fnc_addStackedEventHandler

Event Timeline

This comment was removed by BIS_fnc_KK.
dedmen changed the task status from New to Feedback.Apr 11 2022, 9:16 AM
dedmen set Ref Ticket to AIII-55088.

should be fixed in next dev

BIS_fnc_KK removed BIS_fnc_KK as the assignee of this task.Apr 11 2022, 4:38 PM
BIS_fnc_KK added a subscriber: BIS_fnc_KK.