🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Comments in ExecuteString()

Started by
7 comments, last by B_old 18 years, 3 months ago
Hello, I am wondering wether there are any restrictions regarding comments when using ExecuteString(). I get complaints when using // , /**/ seems to work for me though. Ideas? Thanks.
Advertisement
Do you have \n somewhere in your script? it might be that you are commenting out an entire script... or large parts.
Hm, I don't understand what you mean.

I get a comlaint when I do something like this:

ExecuteString("var = 3; //comment...");
You need to add a line break after the comment. Just like Rain Dog suspected.

What happens is that AngelScript takes your string and concatenates it with a couple of predefined strings to form a function, which is then compiled and executed. With your example the script that is getting compiled is this:

void ExecuteString() {var = 3; //comment...;}


Which obviously won't compile as the closing bracket is commented.

Regards,
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

Hm, should a simple '\n' be enough?
I tried that and also "\r\n" and still got complaints.
It should be enough with a '\n':

ExecuteString("var = 3; //comment...\n");


If this doesn't work, then it is a bug in AngelScript. I'll verify it.

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

It would probably be a good idea to just have AS stick the \n in there itself.
Agreed, and I had already decided to do that. :)

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

Turned out it was my mistake. Sorry.

This topic is closed to new replies.

Advertisement