Android Question How do I use BasicScript ShareArray

Adie

Member
Licensed User
Longtime User
In short:
1: I want to create an array in my B4A project. eg: Public aInVal(1,1) as Int
2: I want to set one cell in the Script eg: aInVal(0,0) = 1234

snip of script:
sScript = sScript & "Dim aInVal(1,1) As int" & CRLF
' this portion of the script is the 'main' sub to run
sScript = sScript & "Sub RunScript" & CRLF
sScript = sScript & " aInVal(0,0) = 123" & CRLF
sScript = sScript & "End Sub" & CRLF
end of script

3: I then want to read the result from the script in the B4A project as LOG( aInVal(0,0) )

What I cant figure out.
1: must the name of the Arrays be the same or NOT THE SAME (aInVal in this case)
2: do I NEED to create the array in the script or can I use SetArray(..) Or is it even neccessary to create the array in the script as we are using a pointer to the original in B4A
3: hbIterpet.ShareArray("aInVal", aInVal ) does not work. I thought the code meant: 'set the pointer of the array with the name "aInVal" in the script to point to the aInVal array in the main app.

no matter what I tried it either do not compile or crash.

Adie
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…