Advertisement
Guest User

tapir

a guest
Jul 3rd, 2015
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.86 KB | None | 0 0
  1. local _tapir = {}
  2. for a, b in ([[
  3. A0 E1 I2 N3 R4
  4. B50 BE51 C52 CH53 D54 DE55 F56 G57 GE58 H59
  5. J60 K61 L62 M63 O64 P67 Q68 S69
  6. T70 TE71 U72 UN73 V74 W76 X77 Y78 Z79
  7. 81 82 _83 .89
  8. ]]):gmatch('(%S-)(%d+)') do
  9.   _tapir[b] = a == '_' and ' ' or a
  10. end
  11.  
  12. local function tapir(s)
  13.   local ret = ''
  14.   local i = 1
  15.   while i <= #s do
  16.     if _tapir[s:sub(i, i + 1)] then ret = ret .. _tapir[s:sub(i, i + 1)]; i = i + 2
  17.     elseif _tapir[s:sub(i, i)] then ret = ret .. _tapir[s:sub(i, i)]; i = i + 1
  18.     else error(s:sub(i, i + 1)) end
  19.   end
  20.   return ret
  21. end
  22.  
  23. print(tapir(([[
  24. 61169 83596 21556 07183 30833 83670 55690 70833 72620 83372 62083 69154 63836 71708 35574 17083 18337 26208 35270 43052 70833 72620 83557 41708 37042 83704 28370 42828 98381 61405 02526 10836 01835 25208 37042 83631 70478 83645 48361 63131 83083 60183 74255 70837 91837 91631
  25. ]]):gsub('%D+', '')))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement