Bug #23570

<nil_variable> call definedFunction; gets ignored with no error within preprocessFileLineNumbers

Added by Fireball almost 4 years ago. Updated over 3 years ago.

Status:Assigned Start date:08/18/2011
Priority:Normal Due date:11/18/2011
Assignee:- % Done:

0%

Category:Scripting: Problem
Target version:-
Affected ArmA II version:1.60 BETA First affected build:
Reproduced by another DH user:Yes First affected ArmA II version:
I am using some Mods:No Single / Multi Player?:
I am using: BIForumURL:
Reproducible for you:Yes NGUrl:
Related to content of DLC: WIKIurl:

Description

Observed

If a nil (undefined) variable gets passed to a defined function, the function will not be called and no error is shown in a preprocessFileLineNumbers context at this point in the repro mission:

test call testHintFnc;

- testHintFnc is defined
- test is not defined (nil)

Expected

Any error of some sort should be shown within the RPT or on screen with -showScriptErrors, something along "Error: Undefined variable passed to function call".

Repro
- examine attached mission
- run the mission
- wait 5 seconds; no error is thrown

CIT_23570_nilCallIgnored.Desert_E.7z (816 Bytes) Fireball, 08/20/2011 18:06

History

Updated by Fireball almost 4 years ago

  • Description updated (diff)
  • Status changed from Feedback to Assigned
  • Assignee deleted (Fireball)

Updated by Fireball almost 4 years ago

  • Subject changed from <nil_variable> call definedFunction; simply gets ignored with no error to <nil_variable> call definedFunction; simply gets ignored with no warning
  • Description updated (diff)

Updated by Fireball almost 4 years ago

  • Subject changed from <nil_variable> call definedFunction; simply gets ignored with no warning to <nil_variable> call definedFunction; simply gets ignored with no warning/error

Updated by Fireball almost 4 years ago

  • Description updated (diff)

Updated by Fireball almost 4 years ago

  • Subject changed from <nil_variable> call definedFunction; simply gets ignored with no warning/error to <nil_variable> call definedFunction; simply gets ignored with no error
  • Description updated (diff)
  • Status changed from Assigned to Feedback

I just re-thought; it must be an error, not a warning, since the function is not executed, so that's fatal. It's the way in every other script/programming language I know.

I'll follow up with a repro anyway.

Updated by Fireball almost 4 years ago

  • File CIT_23570_nilCallIgnored.Desert_E.7z added
  • Subject changed from <nil_variable> call definedFunction; simply gets ignored with no error to <nil_variable> call definedFunction; gets ignored with no error within preprocessFileLineNumbers
  • Description updated (diff)
  • Due date set to 11/18/2011
  • Status changed from Feedback to Assigned

Updated by Fireball almost 4 years ago

I'm mentioning this because the (missing) error behaviour is different than outside preprocessFileLineNumbers; if I put

testHintFnc = {
    hint "Second hint!";
};

hint "A second hint should be displayed in 5 seconds"; 

sleep 5; 
// test is nil!
test call testHintFnc;

outside of preprocessFileLineNumbers I get this error:

Error in expression < be displayed in 5 seconds"; 
sleep 5; 
test call testHintFnc;>
  Error position: <test call testHintFnc;>
  Error Undefined variable in expression: test
File C:\Users\fireball.ZEROUPTIME\Documents\ArmA 2\missions\nilCallIgnored_CIT23570.Desert_E\init.sqf, line 7

While inside of preprocessFileLineNumbers, I get no error and the function is not executed. As long it errors properly, I could care less if the function is executed or not.

Updated by alef almost 4 years ago

The ticket is about whether an error message is logged in RPT (and displayed with -showScriptErrors) or not.
In this init.sqf, you will get the error message when you do
  • #include "loop.sqf"
  • execVM "loop.sqf"
  • file=loadfile "loop.sqf"; code=compile file;
You will not get the error message when from init.sqf you do
  • [] spawn { call compile preprocessFileLineNumbers "loop.sqf"; };

Updated by Fireball almost 4 years ago

  • Reproduced by another DH user changed from No to Yes

Updated by Fireball almost 4 years ago

  • Description updated (diff)

Updated by Fireball almost 4 years ago

  • Description updated (diff)

Updated by CarlGustaffa almost 4 years ago

Yes, very important. Proper error reporting should be high priority.

Also available in: Atom PDF