• Welcome to Valhalla Legends Archive.
 

Function as an array?

Started by CrAz3D, February 02, 2005, 05:04 PM

Previous topic - Next topic

CrAz3D

I have a function that I'd like to have return info in an array.  Is this possible or should I seperate each item and then split the items when the function info is recieved?

Thanks

code might be something like...
MsgBox UBound(GetInfo)
o]

function getinfo () as array?
ubound(getinfo)= hi
redim preserve getinfo(ubound(getinfo)+1)
rebundance - having or being in excess of sheer stupidity
(ré-bun-dance)
Quote from: Spht on June 22, 2004, 07:32 PMSlap.
Quote from: Adron on January 28, 2005, 09:17 AMIn a way, I believe that religion is inherently evil, which includes Christianity. I'd also say Christianity is eviller than Buddhism (has more potential for evil).
Quote from: iago on April 19, 2005, 01:06 PM
CrAz3D's ... is too big vertically, at least, too big with ... iago ...

Newby

Public Function ReturnArr() As String()
    ReturnArr = Split("returns|an|array", "|")
End Function
- Newby

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote<TehUser> Man, I can't get Xorg to work properly.  This sucks.
<torque> you should probably kill yourself
<TehUser> I think I will.  Thanks, torque.

CrAz3D

That semi-confuses me...

function TheFunc() as string()
    TheFunc(1) = "hi"
    TheFunc(2) = "low"
end function


sub DoTheWork()
    Dim Arr() as string 
        Arr()=TheFunc
end sub


Would that work?
rebundance - having or being in excess of sheer stupidity
(ré-bun-dance)
Quote from: Spht on June 22, 2004, 07:32 PMSlap.
Quote from: Adron on January 28, 2005, 09:17 AMIn a way, I believe that religion is inherently evil, which includes Christianity. I'd also say Christianity is eviller than Buddhism (has more potential for evil).
Quote from: iago on April 19, 2005, 01:06 PM
CrAz3D's ... is too big vertically, at least, too big with ... iago ...

Newby

Don't know.

Go stick it in an empty project and call it, and fix it accordingly. :)
- Newby

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote<TehUser> Man, I can't get Xorg to work properly.  This sucks.
<torque> you should probably kill yourself
<TehUser> I think I will.  Thanks, torque.

Hdx

#4
Function TheFunc() As String()
Dim Arry(1) As String
    Arry(0) = "Low"
    Arry(1) = "High"
    TheFunc = Arry
End Function


Sub DoTheWork()
    MsgBox UBound(TheFunc)
End Sub

Its usually good pratice I think Not to use a function as a vareable...
The Above Code Works.
~-~(HDX)~-~

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

CrAz3D

Thanks HdxBmx27, that worked like a charm...?  :-*
rebundance - having or being in excess of sheer stupidity
(ré-bun-dance)
Quote from: Spht on June 22, 2004, 07:32 PMSlap.
Quote from: Adron on January 28, 2005, 09:17 AMIn a way, I believe that religion is inherently evil, which includes Christianity. I'd also say Christianity is eviller than Buddhism (has more potential for evil).
Quote from: iago on April 19, 2005, 01:06 PM
CrAz3D's ... is too big vertically, at least, too big with ... iago ...

Hdx

Never call me by my full username -.- its annoying, Hdx, short, sweet, simple, my name over ALL my usernames, ever wonder why i have
|
V that? O and NP any other questions?
~-~(HDX)~-~

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

dxoigmn

Quote from: HdxBmx27 on February 02, 2005, 06:38 PM
Function TheFunc() As String()
Dim Arry() As String
    ReDim Arry(0 To 1)
    Arry(0) = "Low"
    Arry(1) = "High"
    TheFunc = Arry
End Function


Sub DoTheWork()
    MsgBox UBound(TheFunc)
End Sub

Its usually good pratice I think Not to use a function as a vareable...
The Above Code Works.
~-~(HDX)~-~

Why not just Dim Arry(0 to 1) As String?

Hdx

Um iono, laziy coding, But maby cuz I wanted him to be avle to delete the lines below that and do it for himself.. But ya, mostly cuz i wrote it without looking at what i was dooing 0.o
~-~(HDX)~-~

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

CrAz3D

Yeah, I just publicly declared an array, & then I redim it when needed.

Mucho thanks again HDX!
rebundance - having or being in excess of sheer stupidity
(ré-bun-dance)
Quote from: Spht on June 22, 2004, 07:32 PMSlap.
Quote from: Adron on January 28, 2005, 09:17 AMIn a way, I believe that religion is inherently evil, which includes Christianity. I'd also say Christianity is eviller than Buddhism (has more potential for evil).
Quote from: iago on April 19, 2005, 01:06 PM
CrAz3D's ... is too big vertically, at least, too big with ... iago ...

dxoigmn

Quote from: CrAz3D on February 02, 2005, 10:35 PM
Yeah, I just publicly declared an array, & then I redim it when needed.

Mucho thanks again HDX!

Sounds costly, albeit it is Visual Basic.

Hdx

Quote from: dxoigmn on February 02, 2005, 11:12 PM
Sounds costly, albeit it is Visual Basic.
True, I suggest that he simply has it a private Dim, jsut for that function so it dosent take up as much space, 0.o (MEM wise)
But ya it's vb, what cha gona do? And I cant learn C till Seinor year!!! and noone else but school is willing to teach>.<
~-~(HDX)~-~

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

CrAz3D

It wouldn't be more work/space required to keep re-declaring it EVERYTIME I need it? ( about 5-6 times so far )
rebundance - having or being in excess of sheer stupidity
(ré-bun-dance)
Quote from: Spht on June 22, 2004, 07:32 PMSlap.
Quote from: Adron on January 28, 2005, 09:17 AMIn a way, I believe that religion is inherently evil, which includes Christianity. I'd also say Christianity is eviller than Buddhism (has more potential for evil).
Quote from: iago on April 19, 2005, 01:06 PM
CrAz3D's ... is too big vertically, at least, too big with ... iago ...

UserLoser.

Quote from: CrAz3D on February 02, 2005, 11:58 PM
It wouldn't be more work/space required to keep re-declaring it EVERYTIME I need it? ( about 5-6 times so far )

Maybe this variable should be static then

Blaze

Function TheFunc() As String()
    Static Arry(0 To 1) As String
    Arry(0) = "Low"
    Arry(1) = "High"
    TheFunc = Arry
End Function

Like that? Wouldn't that still be wasting time by stating whats in the variable?
Quote
Mitosis: Haha, Im great arent I!
hismajesty[yL]: No