How to share variables with Yab lib?
#5
if you plan on building your code, you will need to explicitly pass the variables. The following is an xample passing multiple variables to/from an imported library:

#!yab
x=1
y=2
z=3
import test
print x,y,z
dim veriables(3)
veriables(1)=x
veriables(2)=y
veriables(3)=z
dim v$(3)
versible$=test$(veriables())
//print versible$
num=token (versible$,v$(),"|")

x=val(v$(1))
y=val(v$(2))
z=val(v$(3))

print x,y,z
end

test.yab:


export sub test$(v())
x=v(1)
y=v(2)
z=v(3)
x=x+1
y=y+1
z=z+1

print x,y,z


return str$(x)+"|"+str$(y)+"|"+str$(z)

end sub

note: the import command refers to the file containing the subroutine. in this case test.yab ( the .yab is understood and is not used in the import statement) test.yab must be in the program directory or in /boot/home/config/settings/yab/
Reply


Messages In This Thread
RE: How to share variables with Yab lib? - by bbjimmy - 10-08-2024, 01:59 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)
Free Web Hosting