< Back

Document Subject: Passing arrays in functions in lotusscript
Hint Short Cut: Add this to your code & documentation to help you find this page.
http://#PassArrayInFunction or http://A555F9/nn.nsf/ByAlias/PassArrayInFunction

A lotusscript noob colleage was struggling with lotussscript functions and passing and receiving arrays




You basically have to pass and receive arrays as variants.

This is the same as the inferior PHP array_push used by noobs.

 

Sub Click(Source As Button)
 
 Dim ar(1) As String
 ar(0)="1"
 ar(1)="2"
 
 Dim addme As String
 addme="Me"
 Dim res As Variant
 
 res = push(ar, addme)
 
 Print Implode(res)
 
 Forall i In res
  Print i
 End Forall

 
End Sub

 

Function push(arr As Variant, addme As String) As Variant
 
 Dim addon (0)  As String
 addon(0)=addme
 
 push=Arrayappend(arr,addon)
 
End Function