Reply To: building text strings

Home Forums General Programming building text strings Reply To: building text strings

#72218
goodweather
Participant
  • Topics: 45
  • Replies: 550
  • Total: 595
  • ★★★

amazing… you are doing the questions and the answers… however still looking to things in a too complex way 😉

The console is used to display some info while programming or while using a panel but for verifications. I would not use it as an external output window but maybe some Ctrlr developers would do it.

The console is available at 2 places: separate window or as the 4th tab within the Lua editor. I’m using that one most of the time.

You type a statement in the bottom part and get the result in the upper part.
A statement can be anything: one line of code, a check for a variable…

When you type a line of code it is executed. This can be usefull at dev time when you forgot to do something. In that case, the statement is just repeated in the upper part. Example: myVar=10 typed in the lower part gives >>> myVar=10 in the upper part.

To check the value of a variable, you use the console(string) function. The argument must be a string. If not then you get an error message. SO, safest is to always use tostring() to convert.
Try with
console(tostring(myVar))
You will get
>>> console(tostring(myVar))
10
in the upper part.

Now, you can include this console() statement in your Lua code and when the method will run it will write its info in the console window (separate or at the bottom of the Lua editor. The console must be opened prior.

You had also a question about my Miscellaneous method containing a lot of functions.
You name your methods as you want. I discovered that a Ctrlr method is a recipient for any function so I started grouping different functions under one method.
Like Miscellaneous, SpecificDisplays, SupportMethods…

Hope that this time you understood the console() principle.
ANd now I have my text for the console explantion in the step by step guide 🙂

Ctrlr