Results 1 to 3 of 3

Thread: Print any variable's content

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts

    Print any variable's content

    I'm currently into debugging my code and I'd like to print any object to console.
    However I cannot distinguish between an array, a struct or an int/float (if I use .size on an int, a compile error is emmitted):

    PHP Code:
    PrintObjectobj )
    {
        
    elem "undefined";

        if( 
    isDefined( array[ ] ) )
        {
            if( 
    isPlayerobj ) )
                
    elem obj.name;
            else if( 
    isStringobj ) )
                
    elem sprintf"\"%\"" obj );
            else 
    // could be int/float or an array or a struct
                
    elem "{object}";
        }

        
    printf"%\n" elem );

    Is there any way to get the type?
    Last edited by serthy; 13th September 2016 at 18:58.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •