简易拼音输入法 – LUA版
作者: automatic.dai
日期: 2011 年 11 月 24 日
2 条评论
Automatic.dai : 刚刚说到用LUA实现拼音输入法会更加简单,因为LUA天生具有表数据结构– table,以下代码简单示意了LUA如何完成这项工作:
PY.lua : pyTable = {} pyTable["a"] = “阿啊嗄呵吖” pyTable["ang"] = “昂卬盎醃岇骯” pyTable["ba"] = “把吧巴八爸” pyTable["ban"] = “办办版班伴” print(“Enter your PY code:”) str = io.read() if ( pyTable[str]~= nil) then print(pyTable[str]) end 执行结果: |
|