librime-lua
librime-lua copied to clipboard
請問如何將 lua table(list) 轉成 ConfigList
想要新增 ProjectionReg 用途: 調用 xlit xdrive xform 轉置功能 https://github.com/rime/librime/blob/2af37e05ecff5ded7c305609a1cd891d3f7ff5ee/src/rime/algo/algebra.h#L29
namespece ProjectionReg{
typedef Projection T;
an<T> make(ConfigList &l){
an<T> p=New<T> ;
if (!l) return p;
else
p.load(l);
return p;
}
bool load(<T>&t ,ConfigList &l){
return t.load(l);
}
string appyl(<T>&t,string s){
an<String> res=s; // bool Projection::Apply(string *)
if t.Appyl(res)
return s;
else
return NULL;
}
static const luaL_Reg funcs[] = { {"Projection", WRAP(make)},
{ NULL, NULL },
};
static const luaL_Reg methods[] = {
{"load", WRAP(load)},
{"apply",WRAP(apply)},
{ NULL, NULL },
};
static const luaL_Reg vars_get[] = {
{ NULL, NULL },
};
static const luaL_Reg vars_set[] = {
{ NULL, NULL },
};
}
ConfigList ConfigMap 都有提供