Newbie daft question about "read button()"

OK, Stupid question time...

But first - a big thank you to all who are on here helping out us beginners....

I'm getting my head around running multiple sequenced tasks in the "SeveralThingsAtTheSameTime.ino" example.

I'm doing OK, and understanding the states, loops etc etc,.
(Programming isn't new to me, but C++ is).

I'm running aM5Stack core - the only Library I have pulled in at the moment is "M5Stack".

I've opened the example in my editor Arduino 1.8.12

In the main program loop, the call for the function "readbutton()" appears in red.
This tells me that it's an embedded function, as opposed to a function that we define ourselves.
I wasn't expecting this on the example - the example was showing how to call a function from a loop, and the example goes on to define the "readbutton" function.

How do I find out what this function is, and how it works please?
(i.e. when something appears in red, how do I find the function definition?)

Thanks,

Mike.

In the main program loop, the call for the function “readbutton()” appears in red.
This tells me that it’s an embedded function, as opposed to a function that we define ourselves.

No. All it actually means is that “readbutton” is defined as a keyword for one or more of the installed libraries whether or not you are using the library or the function in your program

As to finding the function, you can’t very easily, and in any case you have your own function named the same in the program. To find the function you can search all of the keywords.txt files and even then you may find more than one such function, each with different functionality

Doing that on my PC finds the function in a library named Esplora

For what it’s worth, here is the function

boolean _Esplora::readButton(byte ch) {
  if (ch >= SWITCH_1 && ch <= SWITCH_4) {
    ch--;
  }
  
  switch(ch) {
  case JOYSTICK_RIGHT:
    return joyLowHalf(CH_JOYSTICK_X);
  case JOYSTICK_LEFT:
    return joyHighHalf(CH_JOYSTICK_X);
  case JOYSTICK_UP:
    return joyLowHalf(CH_JOYSTICK_Y);
  case JOYSTICK_DOWN:
    return joyHighHalf(CH_JOYSTICK_Y);
  }
    
  unsigned int val = readChannel(ch);
  return (val > 512) ? HIGH : LOW;
}

Sorry - that's what I meant by "embedded" (it's defined as a keyword in a library).

Thanks for that - it explains why I've been having trouble finding it.

Is there a different editor that can help out (like I have used in HTML in the past)?

Is there a different editor that can help out (like I have used in HTML in the past)?

I don't imagine that any editor is going to have the functionality to jump to arbitrary function definitions in the Arduino environment