lua编写列表的回调函数

ui_callback.list_branch_ir = function(self, index, obj)

    index = index + 1

    if not obj then return end

    local items = self.items

    local ctrl_item = items[obj] or false

    if ctrl_item then

       --如果列表元素存在,执行什么操作。

    else

        --如果列表元素不存在 创建一个

        ctrl_item = CtrlButton(self, obj)

        xxxx

        items[obj] = ctrl_item

    end

end

 

另外注意要在开始的时候设定数量,以及令items = {}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章