It's called the number system.
If you play in the key of C, then 1-2-3-4-5-6-7-8 would represent C-D-E-F-G-A-B-c, where 3-4 is always a half-note away, as well as 7-8, following the natural major scale.
A major chord is always played using 1-3-5. (e.g. C major is C-E-G)
A minor chord is always played using 1-3b-5 (e.g. C minor is C-Eb-G)
A dimished chord, using 1-3b-5b (e.g. C diminished is C-Eb-Gb)
An augmented chord, using 1-3-5b (e.g. C augmented is C-E-Gb)
A major 7th chord, using 1-3-5-7 (e.g. CM7 is C-E-G-B)
A minor 7th chord, using 1-3b-5-7 (e.g. Cm7 is C-Eb-G-B)
A dominant 7th chord, using 1-3-(5)-7b (e.g. C7 is C-E-(G)-Bb)
In case you're wondering why the minor, augmented, and diminished chords somewhat deviate from the number system, it's because they follow their own respective scales. The major chord follows the major scale. The minor chord follows the minor scale. The diminished chord also follows the diminished scale. The augmented chord follows the augmented scale. So they all basically follow the 1-3-5 triad, only on their respective scales. But for the sake of uniformity we will use the natural major scale which the number system is based upon.
In case you haven't noticed, you've been following this number system all along while playing the guitar. You play the C major chord using XCEGCE, and D major, XXDADF# the order and number of repetitions don't matter, as long as you have the right notes -although in some cases the 1st note does matter. So yes, now you know.
So if you meet a piano score and you wanna play the guitar to that musical piece, you can transpose those piano notes (if you can read notes) to guitar chords using this number system.
Although you can transpose each note to guitar, I suggest transposing the ones at the start of every measure, since guitar chords don't change per syllable, but per number of beats in one measure - unless the rhythm completely deviates within that measure.