librime-lua
librime-lua copied to clipboard
利用 schema_id 和 tag (lua_component@tag) 改由 lua_component 利用 loadfile 導入 init ,func,fini
之前討論 由方案載入 lua 不可行之後 ,另一個想法 每個 component 在初始化時 載入 方案.lua 1 component 可調出 schema_id and tag 2 local init=loadfile( schema_id .. ".lua")(tag) ,取得 初始化 env 的 function 3 init(env) -- 將 init(env) func(key,env) , fini(env) 掛入env 4 將 env.func env.fini 掛入 component func_ & fini_ 5 執行 env.init(env)
但有個疑問
之前 lua_component@function_name@tag
現在 lua_component@lua_tag@yaml_tag
我觉得不一定要按lua_component的规则起名字。可以重新起一个名字,这样即可对后面的@
作不同解释,同时不破坏现有的。
我試過 如果 打上 lua_processor@xxx@xx name_spce 會等於最後一個
lua_component init時 檢查 全域 xxx == nil 再LOADFILE
或是 用 config:getstring( "xx/luafile") 取得 userdata/lua/