• Advertisement
Sign in to follow this  

How to get a syntax error line number from Build()?

This topic is 4282 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! In http://www.gamedev.net/community/forums/topic.asp?topic_id=298273 Witchlord wrote: "Especially when calling Build() it is a good idea to pass a pointer to an output stream, example: class COutStream : public asIOutputStream { public: void Write(const char *text) { printf(text); } }; Build the scripts, passing a pointer to the output stream: COutStream out; int r = engine->Build("module name", &out); if( r < 0 ) { // The build failed, verify the messages passed to the output stream } " I tried to use that with Angelscript v2.4.1e under Debian Linux. However I get the following error mesage from g++ : "error: no matching function for call to `asIScriptEngine`::Build(const char[8], COutStream*)' " I called Build as follows: "r = engine->Build("script1", &out);" when I change the call to "r = engine->Build("script1");" then everything works fine. However I like to have the line number if there is a syntax error in the Angelscript file. How do I get the line number if there is a syntax error in the Angelscript file?

Share this post


Link to post
Share on other sites
Advertisement
the correct way to do this is:


class CompilerStream : public asIOutputStream
{
public:
void Write (const char *text) {
// handle error message here
}
};

// ...

CompilerStream* outStream = new CompilerStream ();
engine->SetCommonMessageStream (outStream);

// ...

engine->Build ("your script");





for the line, until witchlord give us a error struct instead of a char*
i think the only way is to parse the char* you receiving.

Share this post


Link to post
Share on other sites
Ultrasparc:

That post is over a year old, and the library has changed a lot since then.

Did you have a look at the samples that came with the SDK? Kunitoki already responded your first question, but the samples and the manual may give you many answers that you might wonder about in the future.

No disrespect meant. You are very welcome to ask any question you like, but sometimes it might just be quicker to look for the answers yourself than having to wait for someone to answer. [smile]

Regards,
Andreas

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement