/pingji_adv_star.lua

https://code.google.com/p/google-pinyin-api/ · Lua · 44 lines · 29 code · 4 blank · 11 comment · 6 complexity · 789a40c2e6244ff3fd30a483fbbded00 MD5 · raw file

  1. -- encoding: UTF-8
  2. ------------------------------------------------
  3. -- ??????? ?? ???
  4. -- ??: 0.1.0.1
  5. -- ???Yichen Lu
  6. -- ?????http://yichenlu.cn/
  7. -- ????: http://code.google.com/p/google-pinyin-api/
  8. --
  9. -- ?????GPLv3??
  10. --
  11. ------------------------------------------------
  12. _YichenLu_Pingji_EMPTY = '?'
  13. _YichenLu_Pingji_FULL = '?'
  14. function YichenLu_Pingji_Adv(input)
  15. if #input > 0 then
  16. a=string.find(input, "/")
  17. if a==nil then
  18. b=tonumber(input)
  19. c=5
  20. else
  21. b=tonumber(string.sub(input,1, a-1))
  22. c=tonumber(string.sub(input,a+1))
  23. end
  24. if b>c then
  25. b=c
  26. end
  27. if b<0 then
  28. b=0
  29. end
  30. out=''
  31. for i=1,b do
  32. out = out .. _YichenLu_Pingji_FULL
  33. end
  34. for i=1,c-b do
  35. out = out .. _YichenLu_Pingji_EMPTY
  36. end
  37. return out
  38. end
  39. end
  40. ime.register_command("pj", "YichenLu_Pingji_Adv", "??", "none", "?? ??/?????????? 5?5/10 ? ??????????")