Script that automatically prints the name of a variable

Discussion in 'Programming' started by kazudennis, Jun 4, 2019.

  1. kazudennis

    kazudennis Member

    Joined:
    Jun 29, 2016
    Posts:
    18
    Good day,
    how can I create a script that automatically prints the name of a variable and its respective value in the debug.
    I should just enter the variable in the script.
    sorry for the english

    i.e:
    if vsp = 4
    scr_message (vsp);
    result;
    vsp = 4
     
  2. jackquake

    jackquake Member

    Joined:
    Aug 17, 2016
    Posts:
    81
    Code:
    show_debug_message("vsp: "+string(vsp));
    To my knowledge, the name of the variable is not accessible.
     
  3. kazudennis

    kazudennis Member

    Joined:
    Jun 29, 2016
    Posts:
    18
    Thanks for answering, I wanted to do that so I did not put everything inside the show_debug_message.
     
  4. EvanSki

    EvanSki King of Raccoons

    Joined:
    Apr 17, 2018
    Posts:
    580
    No matter how you do it, you wont get the exact name of the variable because if you make Cookies = 4. then ask what Cookies is, you will only ever get 4, because Cookies is now 4. Your assigning the space labeled Cookies to hold 4. Cookies == 4. but 4 != Cookies.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice