Jump to content
Sign in to follow this  
gcue

debug (nothing fancy)

Recommended Posts

gcue

nothing fancy, just something i use to output variable or array or even just used to pause between processes

 

Func Debug($variable1 = "", $variable2 = "", $variable3 = "")

  If IsArray($variable1) Then
      _ArrayDisplay($variable1)
  Else

    If $variable2 <> "" Then
        $variable1 &= @CRLF & $variable2
    EndIf

    If $variable3 <> "" Then
        $variable1 &= @CRLF & $variable3
    EndIf

    ClipPut($variable1)

    MsgBox(0, "Debug", $variable1)
  EndIf

EndFunc ;==>Debug
Edited by gcue

Share this post


Link to post
Share on other sites
DatMCEyeBall

For variables I've always used:

Local $aArray[2] = ["one", "two"]
$MyVar = 500

_DebugVar("$aArray")
_DebugVar("$MyVar")
_DebugVar("$DoesNotExist")

Func _DebugVar($sVarString)
    If StringLeft($sVarString, 1) = "$" Then
        $sNewVarString = $sVarString
    Else
        $sNewVarString = "$" & $sVarString
    EndIf
    Execute($sVarString)
    If @error Then
        ConsoleWrite("! Invalid Var """ & $sVarString & """" & @CRLF)
        Return 0
    EndIf
    If Execute("IsArray(" & $sNewVarString & ")") Then
        For $x = 0 To Execute("UBound(" & $sNewVarString & ")") - 1
            ConsoleWrite($sNewVarString & "[" & $x & "] (" & VarGetType(Execute($sNewVarString & "[" & $x & "]")) & ") = " & Execute($sNewVarString & "[" & $x & "]") & @CRLF)
        Next
    Else
        ConsoleWrite($sNewVarString & " (" & VarGetType(Execute($sNewVarString)) & ")" & " = " & Execute($sNewVarString) & @CRLF)
    EndIf
    Return 1
EndFunc

"Just be fred, all we gotta do, just be fred."  -Vocaliod

"That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha

@tabhooked

Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation

Share this post


Link to post
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
Sign in to follow this  

×