无名 发表于 2022-5-8 19:14:40

GGlua第十二课判断包名,软件名那一块

你好!!我叫兔子--今天有别群里r智问包名以及版本的写法--我一寻思这么简单我群里人不会还不会吧--那今天就讲两个函数--gg.getTargetInfo()--获取目标信息--gg.getTargetPackage()--获取包名--版本简单写法,这里我用的是mt管理器进程local v = gg.getTargetInfo()if v.versionCode ~= 22012793 thenprint('当前版本为', v.versionCode, '请卸载重新安装')elsegg.alert("兔子最好看了")os.exit()end--延伸a=gg.getTargetInfo()b=a.versionCodec=a.labeld=a.taskAffinityprint("版本号为",b,"包名为",d,"/软件名为",c)--包名简单写法a=gg.getTargetPackage()b={"bin.mt.plus"}if a ~= b thenprint("错的")elseprint("对的")end--合体后写法①(为了写帖子随手写的,只是为了便于理解,具体写法看具体)local v = gg.getTargetInfo()if v.versionCode ~= 22012793 thengg.toast('当前版本为' ..v.versionCode.. '请卸载重新安装')--这里可以用gg.alert,用if对条件1进行跳转链接elsegg.alert("兔子最好看了")enda=gg.getTargetPackage()b={"bin.mt.plus"}if a ~= b then--在这里也可以直接结束进程.或跳转链接gg.alert("错的")else--这里其实不用写,也可以写直接去跳转下一步的条件gg.alert("对的")endos.exit()--[[脚本已结束::bin.mt.plus]]--②也可以只用获取信息v = gg.getTargetInfo()if v.versionCode ~= 22012793 thengg.toast('当前版本为' ..v.versionCode.. '请卸载重新安装')--这里可以用gg.alert,用if对条件1进行跳转链接elsegg.alert("兔子最好看了")enda={"bin.mt.plus"}if v.taskAffinity ~= a then--在这里也可以直接结束进程.或跳转链接gg.alert("错的")else--这里其实不用写,也可以写直接去跳转下一步的条件gg.alert("对的")endos.exit()--[[脚本已结束::bin.mt.plus]]
http://cdn.u1.huluxia.com/g4/M02/7D/77/rBAAdmICORuAc0jeAA1M-p52eLA462.jpghttp://cdn.u1.huluxia.com/g4/M02/7D/77/rBAAdmICORyASrwcAAKwNtkz_94256.jpg
页: [1]
查看完整版本: GGlua第十二课判断包名,软件名那一块