发帖
充值
 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
9 0

函数本身参数就是数组 如何封装

问答专区 3148 9 2021-8-29 23:16:58
本帖最后由 152324093 于 2021-8-29 23:20 编辑

QQ图片20210829231715.png
截图 漏掉了 下面的


执行   直接看代码吧

  1. local ret = nodeLib.findOne({class="android.widget.ImageView",index="0",level="9"},true)
  2. if ret ~= nil then
  3.         print(ret)
  4. end



  5. function 寻找节点(jdcs)
  6.         local ret = nodeLib.findOne(jdcs[2],jdcs[3],jdcs[4],jdcs[5],jdcs[6],true)
  7.         if ret ~= nil then
  8.                 print(jdcs[1] .. '----节点返回----' ..ret)
  9.                 return true
  10.         end
  11. end


  12. 关闭广告1 = {"关闭广告1",class="android.widget.ImageView",index="0",level="9"}



  13. if 寻找节点(关闭广告1) then
  14.         nodeLib.click(ret)
  15. end
复制代码



我想这种方式传 参数    但是 函数本身就是  数组  这样传过去 不正确

应为每次 参数的数量 也不一定 经常变化

应为我想留着参数1  保留自己 做备注用



使用道具 举报

2021-8-30 00:08:46
本帖最后由 擂布丝 于 2021-8-30 00:18 编辑
  1. function 寻找节点(jdcs)
  2.     local ret = nodeLib.findOne(jdcs[2],true)
  3.         if ret ~= nil then
  4.                 print(jdcs[1] .. '----节点返回----' ..ret)
  5.                 return true
  6.         end
  7. end

  8. 关闭广告1 = {"关闭广告1",{class="android.widget.ImageView",index="0",level="9"}}
复制代码

2021-8-30 00:56:12

感谢雷总感谢雷总感谢雷总
2021-8-30 17:56:09
来学习一下!!
2021-8-30 19:06:38
2021-9-9 03:04:29
shuishuishui
2021-9-13 09:01:45
兄弟,广告用线程怎么弄的,beginthread  这个我一用就报错,按键的线程没问题,头痛!有空给个例子
2022-1-17 13:36:47
函数的写法我都没搞清楚
不错,顶下!
2022-4-14 09:51:04
我来学习下、
您需要登录后才可以回帖 立即登录
高级模式
返回
问答专区