dp-s_doc/Object/ScriptData/ScriptData.md

56 lines
1.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ScriptData 类函数文档
**类说明**
`ScriptData`类为读取PVF相关操作,使用前请现在sqr_main中调用构造函数初始化。
---
### 函数签名
**构造函数**
- `Script(Path = "/home/neople/game/Script.pvf")`
### 参数
- `Path`PVF文件的路径
**这里给出两个例子**
---
```
//在默认路径的PVF
Script();
//在指定路径的PVF 例如/home/neople/game/Script.pvf
Script("/home/neople/game/Script.pvf");
```
---
**懒得写函数原型了 这里直接给出使用例子**
---
```
//读取装备List 读取完的内容在这个Buffer里
local Buffer = ScriptData.GetFileData("equipment/equipment.lst", function(DataTable, Data) {
while (!Data.Eof()) {
local Key = Data.Get();
//注册装备列表 路径写入 数据未读取
DataTable.rawset(Key, {
Path = Data.Get(),
Data = null
});
}
print("加载装备List完成, 共" + DataTable.len() + "个");
});
//读取某一件装备的数据
local Buffer = ScriptData.GetFileData("equipment/character/swordman/weapon/hsword/lgcy_agitto_nitras.equ", function(DataTable, Data) {
while (!Data.Eof()) {
local Buf = Data.Get();
print(Buf);
}
});
```
---