Created
          January 25, 2016 04:29 
        
      - 
      
 - 
        
Save tiansh/ddb7fce994cce3428b69 to your computer and use it in GitHub Desktop.  
Revisions
- 
        
tiansh created this gist
Jan 25, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,73 @@ function Morse(ori) MorseMapping = { ["a"] = ".−", ["b"] = "−...", ["c"] = "−.−.", ["d"] = "−..", ["e"] = ".", ["f"] = "..−.", ["g"] = "−−.", ["h"] = "....", ["i"] = "..", ["j"] = ".−−−", ["k"] = "−.−", ["l"] = ".−..", ["m"] = "−−", ["n"] = "−.", ["o"] = "−−−", ["p"] = ".−−.", ["q"] = "−−.−", ["r"] = ".−.", ["s"] = "...", ["t"] = "−", ["u"] = "..−", ["v"] = "...−", ["w"] = ".−−", ["x"] = "−..−", ["y"] = "−.−−", ["z"] = "−−..", ["0"] = "−−−−−", ["1"] = ".−−−−", ["2"] = "..−−−", ["3"] = "...−−", ["4"] = "....−", ["5"] = ".....", ["6"] = "−....", ["7"] = "−−...", ["8"] = "−−−..", ["9"] = "−−−−.", ["."] = ".−.−.−", [","] = "−−..−−", ["?"] = "..−−..", ["'"] = ".−−−−.", ["!"] = "−.−.−−", ["/"] = "−..−.", ["("] = "−.−−.", [")"] = "−.−−.−", ["&"] = ".−...", [":"] = "−−−...", [";"] = "−.−.−.", ["="] = "−...−", ["+"] = ".−.−.", ["-"] = "−....−", ["_"] = "..−−.−", ["\""] = ".−..−.", ["$"] = "...−..−", ["@"] = ".−−.−.", ["_"] = "/" } if #ori == 0 then return end local result = "" ori = string.lower(ori) for c in ori:gmatch"." do result = result .. MorseMapping[c] .. " " end result = result .. "/ " return {result, string.sub(result, 0, string.len(result) - 3)} end ime.register_command("mo", "Morse", "摩尔斯电码", "none")