Run this code with the Lianja 8.0Beta103 build and study it. If you have issues with the pre-release beta versions please submit tickets. The forums are not the place to discuss issues with beta software. Please adhere to our forum policies.
These tests which i wrote for you should answer all of your questions that you asked.
@var is needed to pass variables by reference as you stated.
Arrays and objects do not need to be passed as parameters using @ as they are always passed by reference. So the @ is optional.
Code:
proc atest()
param myarray, myarray2, myarray3, myarray4
declare myarray[2]
declare myarray2[2]
myarray3 = m.m_array
myobj = object("hello" => "world", "testing" => "again")
amembers(anarray, myobj)
? "after amembers"
? anarray
myarray4 = anarray
? "after amembers assignment"
? myarray4
endproc
proc atest2()
declare array xxx[2]
return xxx
endproc
proc otest2()
myobj = object("hello" => "world", "testing" => "again")
return myobj
endproc
proc otest()
param myarray, myarray2, myarray3, myarray4
myarray = object()
declare myarray2[2]
myarray3 = m.m_obj
myarray3[] = "myarray3"
myobj = object("a" => "a", "hello" => "world", "testing" => "again")
addproperty(myobj,"test","again")
addproperty(myobj,"test2","again")
removeproperty(myobj,"a")
amembers(anarray, myobj)
? "after amembers"
? anarray
myarray4 = anarray
? "after amembers assignment"
? myarray4
endproc
proc atest3
param barry
dimension barry[2]
barry[1] = "this has changed"
endproc
proc otest3
param barry
barry = object("hello","world")
? "otest3"
? barry
endproc
proc otest4
param barry
barry = object("hello","world")
? "otest4"
? barry
return barry
endproc
? "testing arrays"
public array m_array[2]
private var1, var2, var3, var4
atest(@var1, @var2, @var3, @var4)
? "var1"
? var1
? "var2"
? var2
? "var3"
? var3
? "var4"
? var4
? atest2()
? otest2()
declare arrtest[1]
atest3(arrtest)
? arrtest
? "testing objects"
m_obj = object()
private var1, var2, var3, var4
otest(@var1, @var2, @var3, @var4)
? "var1:"+typeof(var1)
? var1
? "var2:"+typeof(var2)
? var2
? "var3:"+typeof(var3)
? var3
? "var4:"+typeof(var4)
? var4
declare arrtest[1]
otest3(arrtest)
? arrtest
? otest4(arrtest)
release var1, var2, var3, var4
private var1[1], var2[1], var3[1], var4[1]
m_obj = object()
otest(var1, var2, var3, var4)
? "var1:"+typeof(var1)
? var1
? "var2:"+typeof(var2)
? var2
? "var3:"+typeof(var3)
? var3
? "var4:"+typeof(var4)
? var4
Bookmarks