Advertisement

A bunch of questions

Started by October 05, 2008 05:37 AM
13 comments, last by Blednik 16 years, 1 month ago
Q: How can I make AngelScript ignore the #include directives in my scripts? I've rewritten the example C++ code that searches and loads any #include-d files with added support (Windows only) to resolve relative paths and differ between #include "somefile.txt" and #include <somefile.txt>. I'm not sure what I'm doing wrong, but any script that has an #include directive inside will error out with this: Unexpected token: '(unrecognized token)'

cya.

EDIT: Oh, and the #include test application works fine by the way.
What the sample application does is simply to replace the first two characters on the line with // before passing the script code to AddScriptSection, thus making the entire line a comment.

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

Advertisement
Implemented. You've been very helpful so far. :)
Just a question/idea about the relative path resolving. Would it be practical to implement a sort of a checksum array that stores MD5 sums of all files that have been included so far? So that when loading new files, they get automatically compared against the list, and if a match is found, the file is dropped because there's a great chance this file has already been included.
I wouldn't implement it like that, unless you're planning on having a large amount of includes, because there wouldn't be enough benefit to justify the extra complexity of the code.

Of course, if you already have the code ready, then sure, why not give a try.

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

Nah, I was just asking. I use the Windows Shell Path Handling Functions to do the work since the project I'm dealing with is supposed to run on windows only. However, I was wondering whether this kind of approach was worth the effort, as it should be OS independent though the code is a cheap implementation, if you ask me (i.e. not perfect).

This topic is closed to new replies.

Advertisement