hchunhui / librime-lua

Extending RIME with Lua scripts
BSD 3-Clause "New" or "Revised" License
310 stars 43 forks source link

composition segmention empty() 要用 .empty() 不能用 :empty() #86

Closed shewer closed 3 years ago

shewer commented 3 years ago

如題 不是很了解 爲何 empty 會是 .empty types.cc methods 都是 用 WRAPMEN(T::empty) 請問如何改成 :empty() 在套一層 bool empty1(T &t) { return T.empty() } 就可以用 :empty()

lua method table:func() --> table.func( self)

https://github.com/rime/librime/blob/bb8c2631402118b6d7c8df7ce63db0352244bd47/src/rime/menu.cc#L72 class Menu https://github.com/rime/librime/blob/bb8c2631402118b6d7c8df7ce63db0352244bd47/src/rime/segmentation.h#L59 class Segmentation : public vector {


===============test empty1 composition & segmention .empty =========================== segmention.empty() 7LuaTypeIRN4rime12SegmentationEE: 0x55652b4c0358 true segmention:empty1() 7LuaTypeIRN4rime12SegmentationEE: 0x55652b4c0358 false composition.empty() 7LuaTypeIRN4rime11CompositionEE: 0x55652b4c04b8 true composition:empty1() 7LuaTypeIRN4rime11CompositionEE: 0x55652b4c04b8 false

hchunhui commented 3 years ago

fixed in #88