Ignoring selected script calls on compile

Started by
1 comment, last by WitchLord 19 years, 8 months ago
What about a feature which allows you to selectively ignore certain calls totally when compiling a script? This would allow construction of an assert-function, for example. So that it could be decided on runtime if the script is being compiled as a "debug" build (with asserts) or as a "release" build without any extra code like this. In API this could be as simple as allowing registration of NULL as method or function pointer. Inside script build code any calls to functions or objects would be just ignored if their handler is NULL. Then application could register NULL handlers instead of the true handlers when it wants to leave the additional debugging code out which is written into the scripts. Alternatively the API could have an option to flag certain functions or methods to be conditional for usage, and on a call to script build it would be told if the conditional stuff should be ignored or compiled normally. Disclaimer: I haven't tried if it would already work this way, although I doubt that would be the case. :-)
--Jetro Lauha - tonic - http://jet.ro
Advertisement
You could probably preproccess the script yourself, stripping out all calls yourself. I'm guessing it's probably faster to use an empty function, though.
This is actually a pretty good idea.

It would only work on functions that doesn't return anything though, i.e. void.

I'll write down the suggestion in my to-do list so I don't forget it. Thanks jetro.

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