Or how about ask the user if they'd like to exit.

If so, then pass a nil result through.

Code
local lnresult = ln.linenoise('\x1b[1;36m[MAME]\x1b[0m> ')
if (lnresult == nil) then 
  lnresult = "" 
  io.write("CTRL+C detected: are you sure you want to exit?") 
  if io.read() == "y" then lnresult = nil end 
end
return lnresult
]]