Skip to main content
GameDev.net gamedev.net
🔒 Locked

Comments in ExecuteString()

Started by B_old Mar 21, 2006 at 2:17 PM 7 replies 1.4k views
Original Post
B_old
B_old
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.
Rain Dog
Rain Dog
Do you have \n somewhere in your script? it might be that you are commenting out an entire script... or large parts.
B_old
B_old
Hm, I don't understand what you mean.

I get a comlaint when I do something like this:

ExecuteString("var = 3; //comment...");
WitchLord
WitchLord
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 - <a href="http://www.angelcode.com/tower" rel
B_old
B_old
Hm, should a simple '\n' be enough?
I tried that and also "\r\n" and still got complaints.
WitchLord
WitchLord
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 - <a href="http://www.angelcode.com/tower" rel
WitchLord
WitchLord
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 - <a href="http://www.angelcode.com/tower" rel
B_old
B_old
Turned out it was my mistake. Sorry.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.