How to use struct-variable as return-value

With Unity-JavaScript, I builded a struct-variable like this:

class axesvar extends System.ValueType{		
	 var X : float;
	 var Y : float;
     var Z : float;
	 var no : int;
	}
private var regaxes : axesvar;

…so the selfmade variable is called regaxes and the new type is axesvar. When I declare a function now, I get a compiler-error in unity:

BCE0101: Return type ‘axesvar’ cannot
be used on a generator. Did you mean
‘IEnumerator’? You can also use
‘System.Collections.IEnumerable’ or
‘object’.

The function was declared like this:

function funcname (inputvar : axesvar) : axesvar {}

What does the error-message mean? How do I correct the error?

Well, from the looks of things we've gotten to the bottom of this one.

Basically, you can't have a function that is to be used in a Coroutine return a value that isn't an IEnumerator. The reasons for this are a little opaque in JavaScript- because the compiler automatically adds in all the things about Coroutines that make them obviously different from other functions (for example, the 'StartCoroutine' command and the requirement for the coroutines to return type 'IEnumerator'), it's not immediately obvious why you can't do this.

Written out fully, a coroutine-running setup looks like this-

function WaitForSomething() : IEnumerator
{
    yield WaitForSeconds(5);
    Debug.Log("I waited, now what?");
}

function Start()
{
    StartCoroutine(WaitForSomething());
}

As you can see, the function to be run as a coroutine returns an 'IEnumerator'- this allows the function to be 'paused' and 'restarted' at the yield statements. The StartCoroutine part cannot take a return value, because it is almost guaranteed not to finish within the same frame that it was started- and so would cause a massive hang if it were run then. The entire point, remember, of making it a Coroutine, is so that the rest of the program can get on with whatever it is doing while the coroutine executes!

As for your other question about the 'imprecise' wait time- the reason why 'WaitForSeconds' isn't exact is because it still only gets polled once per frame- there's no way of telling it to execute at an exact moment, because it doesn't get any say in when there will be time available on the processor. You'd need to use true multithreading as well as an external timing library to achieve that.

I should mention that this confusion is completely nonexistent in the C# implementation of these functions- because the correct syntax is required, it is immediately obvious why what you are trying to do can never work.