Although I'm not sure whether it's documented in the wiki, "m" is a shortcut to swap the left and right mouse button elements. To disable the shortcut, return false:
function console(char,code,modif,event) if char == "m" then tpt.set_console(1); return false end end tpt.register_keypress(console);