How does lutro handle button settings?

Love retroarch and the idea behind lutro, so I have been reading some source files to see how things works over there. I found the lutro-bobble to be quite educative so far, but there’s one thing I don’t understand, it probably has to do with the way that retroarch handles input devices.

I see that in input.lua there’s a bunch of BTN_* constants, does retroarch just assign them to different controllers as they are configured?

Maybe my question seems incomprehensible due to ignorance, I’m quite happy to clarify further.