librime-lua icon indicating copy to clipboard operation
librime-lua copied to clipboard

MemoryReg 異動

Open shewer opened this issue 3 years ago • 0 comments

  1. Memory() 初始化增加 argv[4] callback_func https://github.com/hchunhui/librime-lua/blob/01c61b1d12ff5fb31711b150ad075422e1d7106d/sample/lua/expand_translator.lua#L30-L35

    -- ex1 
     env.mem = Memory(env.engne,env.engine.schema)
     env.mem:memorize( callback_func) -- callback_func
    -- ex2
    env.mem = Memory(env.engne,env.engine.schema, 'translator',callback_func)
    
    
  2. memoize(func) 直接 callback 免去 function(commit) return callback_func end https://github.com/hchunhui/librime-lua/blob/754aaf4c6a515cdc34ebd2ba35ffb778750e92dc/src/types.cc#L1343

        auto r = lua_->call<bool, an<LuaObj>, T &, const CommitEntry &>(memorize_callback, *this, commit_entry);
    
  3. lookup func return an 可以同時產生多組 iter 組合應用

  4. 增加 DictEntryIterReg UserDictEntryIterReg 配合 第四項

shewer avatar Sep 24 '22 05:09 shewer