A method marked with the LispFunction attribute should return a ResultBuffer only if you are returning a list.
If you are returning an atom, you just return that value directly.
For example, this method will return the symbol T:
Code:
[LispFunction("foo")]
public static object Foo( ResultBuffer args )
{
return true;
}
and this will return the integer 99:
Code:
[LispFunction("bar")]
public static object Bar( ResultBuffer args )
{
return 99;
}
and this will return the string "Hello":
Code:
[LispFunction("baz")]
public static object Baz( ResultBuffer args )
{
return "Hello";
}
IOW, the result of your lisp-callable function does not have to be a ResultBuffer, it can be that, or any value you can put into a TypedValue's Value field as well. The runtime looks at the result and converts it to the appropriate LISP result. In the case of System.Boolean, that would be the symbol T for True, or NIL for False.
You cannot return COM objects to VisualLisp using LispFunction, but you write a COM-callable wrapper that can return COM objects or any other ActiveX compatible type, which can be called from LISP using VLAX-* functions.