Call function when Enter is pressed

Good day everyone!

I’d like to ask how to call a function when the Enter button is pressed on the keyboard. I have this highscore thing and the problem is when the user writes the username and pushes Enter, it goes to a new line. Is there a way to make it call a function (save the thing) or better yet change “return” to “go” and then call a function?

Thanks in advance.

Here, add any additional functions after hideKeyboard()

function keyboard(k)
    if k == "\
" then 
        hideKeyboard() 
        return 
    end
end

@Luatee @gamebug The keywords RETURN and BACKSPACE can be used in the keyboard routine. See below.

function keyboard(k)
    if k == RETURN then 
        hideKeyboard() 
        return 
    end
end

@Dave1707 I know but
is shorter and relates to the string character, seems more understandable to me as I use it a lot in creating text boxes and stuff for multiline

Thank you very much guys!