Advertisement

Relaxing script section is empty warning

Started by October 24, 2014 01:29 AM
1 comment, last by WitchLord 9 years, 11 months ago

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!

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

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement

I've removed this compiler warning in revision 2097.

Thanks,

Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement