Jump to content

Variable gives me an error!?


Recommended Posts

Every time i quit the server, the client gives me this error:

If $ret[2]=~~rejected" Then

If $ret^ ERROR

Error: Subscript used with non-Array variable

$ret = DLLCall("au3xtra.dll","int","TCPRecv", "int", $socket, "str", "", "int", 512 ) 

   If $ret[2] = "~~rejected" Then
      Sleep(2000)
      DLLCall("au3xtra.dll", "int", "TCPSend", "int", $socket, "str", "~~whatever")
      ExitLoop
   ElseIf $ret[2] = "~~bye" Then
      Sleep(2000)
      ExitLoop
   EndIf
Link to comment
Share on other sites

Error: Subscript used with non-Array variable

$ret failed to recieve the Array!

"If the function call fails then @error is set to 1."

How to safely apply array returning functions with AutoIT

$ret = DllCall("au3xtra.dll","int","TCPRecv", "int", $socket, "str", "", "int", 512 ) 

   If(@error <> 1) Then 
    ;Success of DllCall
    If $ret[2] = "~~reject.......
   Else 
    ;DllCall failed to assign $ret to array ($ret = nonarray!)
     .....
   EndIf
Edited by Pickled
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...