🎉 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!

void arguments

Started by
0 comments, last by WitchLord 19 years, 8 months ago

void i_return_void()
{}

void i_take_no_params()
{}

void foobar()
{
   i_take_no_params(i_return_void());
}

Angelscript doesn't support this at the moment, and although it seems a little odd, it does have an occasional use (and is valid in C++). Would it be too much to ask to add this functionality? Below is why I'm asking. When using ExecuteString it is nice sometimes to be able to catch and view arbitrary return values.

void cmd_execute_test(string& buffer)
{
	buffer = "catch(" + buffer + ")";

	string output = Execute(buffer);

	this->EnqueueOutput(output);
}

void catch()			{} // This one does not work
void catch(Data* obj)		{ dump(obj); }
void catch(bool retval)		{ this->EnqueueOutput(retval ? "Return: true\r\n" : "Return: false\r\n"); }
void catch(int retval)		{ this->EnqueueOutput("Return: " + retval + "\r\n"); }
void catch(float retval)	{ this->EnqueueOutput("Return: " + retval + "\r\n"); }
void catch(string retval)	{ this->EnqueueOutput("Return: " + retval + "\r\n"); }

Joe
Advertisement
I see your point. That does indeed look handy.

I can't say how much work it would take to implement something like it though, but I suspect that most of the work would be to analyze what would have to be changed and not the actual change itself.

I'll put your suggestion in my to-do list and I'll see when I can get it done.

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