Jump to content
ianbanks

Article about nil: why any, scalar and [0x2917924] show up, and how SQF with nil is evaluated.

Recommended Posts

I've done a fair bit of digging into the oddities of nil and have written them up in an article:

 

The Dark Side of nil

 

Seems like a pretty unexciting topic but I've found knowing the details very helpful in troubleshooting SQF problems!

 

The lack of distinction between a private variable containing a nil and an undefined private variable also crops up in code (even BIS functions) at times:

 

http://feedback.arma3.com/view.php?id=20643"BIS_fnc_getFromPairs is unable to return nil when key cannot be found"

http://feedback.arma3.com/view.php?id=15259"BIS_fnc_areEqual returns true if both param's are nil"

(And many more!)

 

  • Like 1

Share this post


Link to post
Share on other sites

Good work, something I've been thinking about myself actually. We must be thrilling company at parties. :)

 

edit1: As SQF is my first foray into coding in many years, I didn't have any preconceptions about nil and it never occured to me that having nul as well might be odd. What does annoy me regularly is something you briefly touched on and that is how errors in unscheduled code might not give errors. How some scripts can fail utterly because of a coding mistake without an error message really annoys me.

 

edit2: if you have a biki account, it would be very useful to link your article on there.

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×