After discovering the code of librime and librime-lua
I realized that might have a solution to let lua access rime::user_dict
|
class LuaTranslator : public Translator { |
let luaTranslator extends rime::Memory first simply
public LuaTranslator : public Translator , public Memory{}
then as Memory.cc showed
https://github.com/rime/librime/blob/4e518b96a381c5ee2e82d43247d9f49886af8b75/src/rime/gear/memory.cc#L54
https://github.com/rime/librime/blob/4e518b96a381c5ee2e82d43247d9f49886af8b75/src/rime/gear/memory.cc#L60
it would initialize user_dict_ and dict_ and store in the object,
so you could pass these two to lua
as you did like this line
|
static void raw_init(lua_State *L, const Ticket &t, |
But I'm unfamiliar to passing object to lua.
so I came to acquire your option to this assume, I wonder if it works, and can I just simply pass the object like lua.org examples told.
After discovering the code of librime and librime-lua
I realized that might have a solution to let lua access rime::user_dict
librime-lua/src/lua_gears.h
Line 52 in d45a41a
let luaTranslator extends rime::Memory first simply
then as Memory.cc showed
https://github.com/rime/librime/blob/4e518b96a381c5ee2e82d43247d9f49886af8b75/src/rime/gear/memory.cc#L54
https://github.com/rime/librime/blob/4e518b96a381c5ee2e82d43247d9f49886af8b75/src/rime/gear/memory.cc#L60
it would initialize
user_dict_anddict_and store in the object,so you could pass these two to lua
as you did like this line
librime-lua/src/lua_gears.cc
Line 25 in d45a41a
But I'm unfamiliar to passing object to lua.
so I came to acquire your option to this assume, I wonder if it works, and can I just simply pass the object like lua.org examples told.