Quinch Posted August 12, 2008 Share Posted August 12, 2008 Is there a way to get a string form of a variable? Specifically... Func Array_Insert($pid, ByRef $array) If IsInt($pid) = 0 Or $pid <= 0 Then LogWrite("WARNING: PID "&$pid&" is not a natural number. Terminating script. Dumbass.") Exit ElseIf PID_Lookup($pid, $actors) = 0 Then ReDim $array[Ubound($array, 1)+1][Ubound($array, 2)] $array[Ubound($array, 1)-1][0] = $pid LogWrite("Item inserted in the "&$array&" array.") Else LogWrite("PID "&$pid&" already exists. Insertion aborted.") EndIf EndFunc In the eighth line, I want a successful insertion to be logged, with the name of the array the value's been added to - but as it is written, the $array variable just returns a blank, presumably due to the ByRef keyword. Any suggestions on what I should try? Link to comment Share on other sites More sharing options...
JFee Posted August 12, 2008 Share Posted August 12, 2008 Well It looks to me like $Array is an array, and you aren't using $array[X][X] you are just writing $array Regards,Josh Link to comment Share on other sites More sharing options...
Quinch Posted August 12, 2008 Author Share Posted August 12, 2008 Well It looks to me like $Array is an array, and you aren't using $array[X][X] you are just writing $array Yeah, but I don't need the value inside the referenced $array.. I need the actual variable name in string form. Link to comment Share on other sites More sharing options...
JFee Posted August 12, 2008 Share Posted August 12, 2008 (edited) I don't know of any way to do that, or why you would wan't to do that. Add another parameter in your function. EDIT: Or depending on how you are using your arrays, I would do something like: Dim $array[x][x] $array[0][0] = "name" And then just use that 0,0 value as the name Edited August 12, 2008 by JFee Regards,Josh Link to comment Share on other sites More sharing options...
Quinch Posted August 12, 2008 Author Share Posted August 12, 2008 I don't know of any way to do that, or why you would wan't to do that. Add another parameter in your function Well, I'd want to do that because I have a bunch of arrays which might use the same function, so having a log of what went on where and when is going to be useful. I could add another parameter, but it seems kinda messy. Link to comment Share on other sites More sharing options...
JFee Posted August 12, 2008 Share Posted August 12, 2008 Read my EDIT in the above post. When you dim an array, give its [0][0] value the name you want to associate, or something along those lines Regards,Josh Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now