-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
使用的是最新版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的更改,这是比较成功的案例。
期待你对本次情况的优化
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request