• Advertisement
Sign in to follow this  

void arguments

This topic is 4946 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

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

Share this post


Link to post
Share on other sites
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.

Share this post


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

  • Advertisement