Author Topic: Printing Variable Contents  (Read 3120 times)

0 Members and 1 Guest are viewing this topic.

Offline NilG

Printing Variable Contents
« on: April 22, 2019, 01:21:24 PM »
Hey all,

Probably a ridiculous beginner question, but I've taken a look a couple of times and just don't know how to print out the contents of a variable, just so I can check what a local or global is set to.  Not looking for anything magic, I just haven't been able to sort the syntax to a Print statement that allows it to print the contents rather than the variable name itself.

So yeah, I think pretty basic, but could be useful in some debugging while wrapping up, and just in better understanding some of the behind-the-scenes behavior.

Offline troflip

Re: Printing Variable Contents
« Reply #1 on: April 22, 2019, 02:09:50 PM »
FormatPrint uses the same formatting characters as C's printf. So you can do something like:

(FormatPrint "Ego x: %d" (ego x?))
Check out my website:
Groundhog Day Competition

Offline NilG

Re: Printing Variable Contents
« Reply #2 on: April 27, 2019, 11:15:22 AM »
Nice, thanks.  Didn't figure it would be super complicated, but I suck.

SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.036 seconds with 22 queries.