Return "Key?"

Kind folks – can anyone tell me how to detect when the return key has been pressed on the keyboard? I found a few sample codes to detect the backspace (simple enough!) but the return key eludes me.

Thanks for any help!

–R

We should add a constant like RETURN for this, as "
" is very unintuitive. (It’s simply the newline character.)

How can we check whether the keyboard is hidden by pressing hide keyboard key?
If it is hidden, we can force to show the keyboard by calling showKeyboard().

@sanit I’ll add a feature to determine whether it’s showing.

At the moment you can’t.

@Simeon Thank you. I think it.might be useful when working with keyboard.

function keyboard(key)
    if key == "\
"
        print("Return Pressed")
    end
end

Simeon, thanks as always – I’ll give it a try!

@simeon: what if showKeyboard() and hideKeyboard() merged into single keyboard(visible: boolean) function? Visible param is to set the keyboard appearance. If no param supplied, the function returns the current keyboard appearance state.

Hence, the keyboard() event-loop need to be renamed, for example keypressed() or keytouched(). But this will create incompatibility with old code that relies on keyboard() function.