Can I return a List from a LotusScript Function?

molasses picture molasses · Feb 27, 2009 · Viewed 13.4k times · Source

I want to return a List from a Function in LotusScript.

eg.

Function myfunc() List As Variant
    Dim mylist List As Variant
    mylist("one") = 1
    mylist("two") = "2"
    myfunc = mylist
End Function

Dim mylist List As Variant
mylist = myfunc()

Is this possible?

If so, what is the correct syntax?

Answer

molasses picture molasses · Feb 27, 2009

It seems you can't return a List from a Function.

You can easily wrap it in a class though and return the class.

eg.

Class WrappedList
    Public list List As Variant
End Class

Function myfunc() As WrappedList
    Dim mylist As New WrappedList
    mylist.list("one") = 1
    mylist.list("two") = "2"
    Set myfunc = mylist
End Function

Answer was found here: LotusScript's List bug strikes again