Jump to content
  • Advertisement
Sign in to follow this  
asterix12

Why so much verification in scriptin

This topic is 3047 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I notice from many script there is verification like: -- Here it check if the variable is not nil. local s = application.getCurrentUserScene ( ) if ( s ~= nil ) Thanks

Share this post


Link to post
Share on other sites
Advertisement
Most scripting languages are quite dynamic. Variables and functions are created on the fly at runtime. It becomes far more difficult to do static analysis of basic errors like those available to more structured languages.

A lot of checks (variables existing, function argument existance and type matching) that would be caught in a separate compile pass need to be checked at run time in most scripting languages.

This is the price you pay for rapid development and using higher level features in the scripting language.

Share this post


Link to post
Share on other sites
Assuming that everything will go according to plan in programing can be quite risky especially in dynamic envorionement.

Like rip-off said, scripting languages allows a lot of flexiblity especially at run time, therefore you should not assume but you should check.

In short better be safe than sorry.
It's common good pratice, of course you're free to not do it ^^

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!