Skip to content

Commit 9fcad3d

Browse files
author
Zing
committed
修正 lrappsoft 风格文档,移除错误的 require 示例
1 parent e4cade9 commit 9fcad3d

1 file changed

Lines changed: 12 additions & 47 deletions

File tree

docs/lua_engine/model/lrappsoft/README.md

Lines changed: 12 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -26,39 +26,23 @@ lrappsoft/
2626

2727
## 4. 使用方法
2828

29-
### 4.1 导入模块
29+
lrappsoft 风格包的模块通过 Go 注入到 Lua 引擎中,无需在 Lua 脚本中使用 require 导入。
3030

31-
在 Lua 脚本中,可以使用 `require` 函数导入 lrappsoft 风格包的模块:
31+
### 4.1 直接调用模块
3232

33-
```lua
34-
-- 导入 device 模块
35-
local device = require("lrappsoft.device")
36-
37-
-- 导入 time 模块
38-
local time = require("lrappsoft.time")
39-
40-
-- 导入 console 模块
41-
local console = require("lrappsoft.console")
42-
```
43-
44-
### 4.2 基本使用示例
33+
由于 lrappsoft 风格包的模块已经通过 Go 注入到 Lua 引擎中,您可以直接在 Lua 脚本中调用这些模块,无需使用 require 导入。
4534

4635
```lua
47-
-- 导入模块
48-
local device = require("lrappsoft.device")
49-
local time = require("lrappsoft.time")
50-
local console = require("lrappsoft.console")
51-
52-
-- 点击屏幕
36+
-- 直接调用模块
5337
device.click(500, 500)
54-
55-
-- 输出日志
56-
console.log("点击成功")
57-
58-
-- 等待 2 秒
5938
time.sleep(2000)
39+
console.log("点击成功")
6040
```
6141

42+
### 4.2 模块说明
43+
44+
lrappsoft 风格包的模块路径是 `lrappsoft.模块名`,但由于模块已经通过 Go 注入,您可以直接调用模块方法。
45+
6246
## 5. 如何迁移懒人的 Lua 脚本
6347

6448
由于 lrappsoft 包实现了大部分懒人的 Lua 方法,因此可以直接调用这些方法,无需修改太多代码。以下是迁移步骤:
@@ -72,7 +56,6 @@ time.sleep(2000)
7256
### 5.2 迁移示例
7357

7458
**原懒人脚本**
75-
7659
```lua
7760
-- 导入模块
7861
local device = require("device")
@@ -81,38 +64,20 @@ local console = require("console")
8164

8265
-- 点击屏幕
8366
device.click(500, 500)
84-
8567
-- 输出日志
8668
console.log("点击成功")
87-
8869
-- 等待 2 秒
8970
time.sleep(2000)
9071
```
9172

9273
**迁移后脚本**
93-
9474
```lua
95-
-- 导入模块
96-
local device = require("lrappsoft.device")
97-
local time = require("lrappsoft.time")
98-
local console = require("lrappsoft.console")
99-
100-
-- 点击屏幕
75+
-- 直接调用模块(无需 require)
10176
device.click(500, 500)
102-
103-
-- 输出日志
104-
console.log("点击成功")
105-
106-
-- 等待 2 秒
10777
time.sleep(2000)
78+
console.log("点击成功")
10879
```
10980

110-
### 5.3 注意事项
111-
112-
1. 部分懒人脚本的高级功能可能需要额外调整
113-
2. 对于不支持的方法,需要使用 AutoGo 原生 API 进行替代
114-
3. 迁移过程中建议逐步测试,确保每个功能正常
115-
11681
## 6. 模块说明
11782

11883
### 6.1 device 模块
@@ -132,4 +97,4 @@ time.sleep(2000)
13297
1. lrappsoft 风格包的模块路径是 `lrappsoft.模块名`
13398
2. 所有函数的参数和返回值与懒人脚本保持一致
13499
3. 使用前请确保已导入所需的模块
135-
4. 详细的模块 API 文档请参考各模块的 README.md 文件
100+
4. 详细的模块 API 文档请参考各模块的 README.md 文件

0 commit comments

Comments
 (0)