Advertisement

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

Started by May 29, 2006 07:38 AM
1 comment, last by WitchLord 18 years, 6 months ago
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?
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.
Advertisement
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

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