Jump to content

problem with IsDeclared


magaf
 Share

Recommended Posts

after

if IsDeclared ( Eval ($x[$x[0]])) = 0 then Assign ( $x[$x[0]], "a")

i call a function and i want it to take the variable i made there so i use

Eval ($x[$x[0]])

as the parameter i send and in the function i take it ByRef when i did that it gave me an error:

"Expected a variable in user function call."

why is that? there should be a variable already...

Link to comment
Share on other sites

IsDeclared requires the NAME of the variable to be quoted in the function:

$x = 4
msgbox(0, "", IsDeclared("x")

Notice no $x in the function, but instead just x in quotes. For your particular problem, therefore, it will not work because you have an array.

Who else would I be?
Link to comment
Share on other sites

after

if IsDeclared ( Eval ($x[$x[0]])) = 0 then Assign ( $x[$x[0]], "a")

i call a function and i want it to take the variable i made there so i use

Eval ($x[$x[0]])

as the parameter i send and in the function i take it ByRef when i did that it gave me an error:

"Expected a variable in user function call."

why is that? there should be a variable already...

<{POST_SNAPBACK}>

What did you call the variable?

You have to use a real variable in the header of the function.

Example:

Func TestFunc($a, $b)
If $a <> "" AND $b <> "" Then
  ;Do stuff
EndIf
EndFunc

I don't understand exactly how ByRef works, so I can't help you with that.

Edited by SlimShady
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...