Page MenuHomeFeedback Tracker

OBJECT setVariable NIL does not delete variables
New, NormalPublic

Description

Using a value of nil with setVariable on an object, the variable is not deleted from the object. For example:

allVariables player; // Returns: []
player setVariable ["something", true, true];
allVariables player; // Returns: ["something"]
player setVariable ["something", nil, true];
allVariables player; // Returns: ["something"]

This in my opinion is very unexpected behaviour and has potential for performance degradation in MP environments. Because the variables are not being deleted correctly, JIP clients are still being sent those variable names along with a value that when converted to a string returns "<null>".

However using missionNamespace instead of an object such as player will result in what I believe is, or at least should be the intended behaviour. In this case the variable is correctly deleted and the variable can no longer be returned using allVariables missionNamespace.

Details

Severity
Major
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
Scripting
Steps To Reproduce
allVariables player; // Returns: []
player setVariable ["something", true, true];
allVariables player; // Returns: ["something"]
player setVariable ["something", nil, true];
allVariables player; // Returns: ["something"]

Event Timeline

Nimrod created this task.May 2 2020, 3:08 PM
dedmen claimed this task.May 2 2020, 3:08 PM

Hopefully fixing this will result in fewer server restarts needed to maintain/restore performance

this is used a lot in our mp mission and I imagine the impact of not deleting variables is large, in our case.

This comment was removed by dedmen.
This comment was removed by BIS_fnc_KK.