only52607 / luamiraiforandroid Goto Github PK
View Code? Open in Web Editor NEWLuaMirai安卓客户端
License: GNU Affero General Public License v3.0
LuaMirai安卓客户端
License: GNU Affero General Public License v3.0
Describe the bug
未知原因,在thread使用Bot相关代码会导致整个软件层的闪退
包括但不限于
①直接使用Bot(QQ号)
②变量赋值Bot对象并调用
To Reproduce
①编写对应代码(thread代码套Bot代码)
thread(function()--线程
--原本有while,后来用了sleep也不好使
--因此删除了while true do,但不影响闪退
g=Bot(qq):getGroup(群号)
end)
②导入脚本并(在有Bot在线时)执行
③恭喜,闪退了
Expected behavior
没有症状,直接闪退,且没有错误日志
Screenshots
由于前面是线程执行loadstring/loadfile内包含Bot指令(脚本前面给mybot赋值了自动获取的Bot对象,因此此截图仍然适用)
(注:前面有调用过变量执行Bot命令,读取文件执行会闪退,而图片问题虽不与更改后的Issues内容相关,但也可能是在线程中使用loadstring出现的部分代码无法执行的问题)
(注:没有执行os.exit)
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Is your feature request related to a problem? Please describe.
我在做脚本的时候经常需要reload,但是需要回去手动开关,而且脚本位置在内置数据目录("/data/data/com.ooooonly.lma/flies/scripts"),需要root权限才能编辑,而且以数字命名,不易分辨
Describe the solution you'd like
①重载脚本
实时检测(不太现实)
②脚本位置以及编辑
可以尝试转移外置存储(如"/sdcard/LuaMirai/scripts/"),并不使用随机数字命名(建议在添加脚本时让用户自行为文件取名)
Describe alternatives you've considered
①为脚本提供新代码:reload()--重新载入脚本
②内置脚本代码编辑器
Additional context
使用的是最新版LuaMirai的apk包
问题一:io库的读写无法使用
导入脚本时,已授予一个储存权限,但脚本内无法使用io库的写入文件功能。需要自己去AndroidManifest.xml中添加<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
权限,添加完成后手动授权可使用io库。
该问题出现时无报错日志。
问题二:require、loadfile和dofile等函数加载外部文件
1.脚本内容
共两个脚本,分别为“测试.lua”和“mod.lua”,存放在/sdcard/RotoGame/scripts/目录下,“测试.lua”作为主文件导入软件内加载。
“测试.lua”内容如下:
-- LuaMiraiScript --
-- name: 测试
-- author: DM
-- version: 1.0
-- description: 测试
-- /LuaMiraiScript --
print(package.path)
--[[local a = "/sdcard/RobotGame/?.lua;/sdcard/RobotGame/scripts/?.lua;/sdcard/RobotGame/scripts/components/?.lua;"
a = a.."/sdcard/RobotGame/scripts/entities/?.lua;/sdcard/RobotGame/cache/?.lua;"
package.path = a
print(package.path)]]
require("mod")
“mod.lua”的内容如下:
M = {}
function M:P(arg)
print(arg)
end
return M
使用require导入执行时报错内容如图:
使用loadfile导入执行时报错如图:
使用dofile导入执行时报错如图:
使用package.path 或者将文件拷贝到/data/user/0/com.ooooonly.lma/files/scripts/目录也无济于事。
问题推断:不知道是你项目对接LuaJ出的问题,这里比较推荐是参考GameGuardian中对LuaJ的更改,这是比较成功的案例。
期待你对本次情况的优化
Describe the bug
无法调用已定义的(中文名)函数?
To Reproduce
Steps to reproduce the behavior:
①在脚本任意位置编写(function xxx() end , xxx={["xx"]=function() end}(这个有时候不行) 或 xxx=function() end 形式)
②调用
③在绝大多数情况下都会出错:attempt to index ? (a nil value)
我已将错误信息在必应搜索,但未能找到原因
Expected behavior
只能构造,无法调用(大多数情况,使用table构造的可以调用,在某些情况(未知)也会失效)
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
建议还是修一下吧,我这边写脚本需要,为了方便我使用中文,如果修不了那也罢了,谢谢作者
Describe the bug
以下均为java.lang.reflect.InvocationTargetException异常
执行已存在的方法出错
event.group:setName("测试")--修改群名称?
在执行下面的代码时出现异常
local mb=event.group:get(tonumber(任意在群里的QQ号))--转换成Member以执行
event.group:sendMessage("尝试执行中...")
local time=60*60*60*24*29--简易计算
mb:mute(time)--禁言(异常处)
To Reproduce
Steps to reproduce the behavior:
对任意Member调用方法mute即可,而且不局限于禁言,部分方法都会出现此异常(比如代码中出现但未在文档中出现的Group:setName(String)也无法调用)
Expected behavior
出现java.lang.reflect.InvocationTargetException错误,无法执行
Desktop (please complete the following information):
Smartphone (please complete the following information):
放function里无报错 还以为是我写错了 拿出来才有报错
文档有3个参数 url body config
全写上还提示 method POST must have a request body.
换了多个api测试一下午 应该能确定不是我的问题 发起issue
Http.post("http://api.tianapi.com/hotreview/index","key=key")
改了好几次 github没办法换行 凑合看吧 已测试mirai最新版pc安卓都此情况
另开Issues到#86
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.