Currently, the getVariable command wont work as expected on locations with its alternative syntax (without a default value --> only string, it will work as expected)
- Legacy ID
- No Bug
Execute following code somewhere in your environment
GVAR_GVARS_missionContext = createLocation ["NameVillage", [0, 0, 0], 0, 0];
GVAR_GVARS_missionContext getVariable [ "MissionReady" , false ]
Can confirm this issue. RPT says:
11:46:45 Error in expression <LOC getVariable ["Test", 2]>
11:46:45 Error position: <getVariable ["Test", 2]>
11:46:46 Error Generic error in expression
Wiki claims that the alternative syntax is supposed to work with locations:
varspace getVariable [name, defaultValue]
varspace: [Namespace]], Object, Display, Control, Group, Location, Task or Team Member
tbh this is the biggest BS i have ever had to read
the alternative syntax adds a default value thus it is not a C&P mistake on the wiki but more that somebody at BI forgot to C&P the default part for locations
i cannot see a valid reason why locations should not have default values in getVariable
TASK and LOCATION both support only STRING argument:
"b:TASK getvariable STRING"
"b:LOCATION getvariable STRING"
This is why both throw error when ARRAY is passed. Both variants are also pretty old and alt syntax was simply never implemented. I resolved this ticket because according to its content, this is not a bug. But feel free to make a feature request to extend functionality.