Skip to content

A possibility might let lua access to rime::user_dict & rime::dict #77

@TsinamLeung

Description

@TsinamLeung

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions