Jump to content
  • Advertisement
Sign in to follow this  
iraxef

Relaxing script section is empty warning

This topic is 1365 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 have a use-case for a script like so:

// scriptA.as

#include scriptB.as
#include scriptC.as

My preprocessor encounters each #include line and calls AddScriptSection with the source of each of those files (e.g. AddScriptSection("scriptB.as"), followed by AddScriptSection("scriptC.as"), then replaces each line with a newline in scriptA.as (since the compiler wouldn't compile an actual #include line).

 

When I call AddScriptSection("scriptA.as") with what looks like the following for the source:

// scriptA.as



it gives me a warning about an empty script section.

 

It's not trivial to attempt to detect that this script section is indeed empty (before calling the final AddScriptSection()) as it would involve parsing for comments.. you can't just check whether the string is all empty/newlines.

 

Do you think it would be feasible to silently soft-fail on an AddScriptSection() with an empty source if the module already has other source (e.g. in other script sections added previously)? Perhaps as an engine option?

 

Thank you for any tips!

Edited by iraxef

Share this post


Link to post
Share on other sites
Advertisement
I'll look into this. Perhaps only warning about empty sections if all are empty might be better as you suggested.

The warning was added because there were a couple of developers that accidentally tried to compile empty sections and obviously the result wasn't what they expected. So rather than giving an error when the application couldn't find the expected function or class, which may not be too clear about why the function or class is missing, I felt it better to give a warning when the section was empty. smile.png

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!