元資訊
XPP 腳本包中需要一個名為 Info.lua 的腳本,返回一個用於描述目前腳本應用包元資訊的 Lua 表常量。它通常不應該包含常量值以外的 Lua 代碼。
以下是一個典型的 Info.lua 範例:
return {
BundleIdentifier = "com.yourcompany.yourscript";
BundleVersion = "0.0.1";
BundleName = "Your Name";
BundleDisplayName = "\U4f60\U7684\U540d\U5b57";
BundleIconFile = "appicon.png";
Executable = "xui-script.lua";
MainInterfaceFile = "xui-demo.xui";
MinimumSystemVersion = "10.0";
MaximumSystemVersion = "10.2";
MinimumXXTVersion = "1.1.2";
SupportedResolutions = {
{
width = 640;
height = 1136;
};
};
PackageControl = {
AuthorName = "i_82";
AuthorEmail = "[email protected]";
Description = "";
Homepage = "https://82flex.com";
};
};
Info.lua 返回的表通常包含以下鍵值對,各鍵值對的詳細解釋參見各子章節:
| 鍵 | 必選 | 建議 | 描述 |
|---|---|---|---|
| BundleIdentifier | * | * | 唯一標識符 |
| BundleVersion | * | * | 版本號 |
| BundleName | * | * | 名稱 |
| Executable | * | 可執行入口腳本檔名 ( .lua, .xxt ) | |
| BundleDisplayName | * | 顯示名稱 | |
| BundleIconFile | * | 應用圖示 | |
| MainInterfaceFile | * | XUI 入口設定檔名 ( .xui, .xuic ) | |
| MinimumSystemVersion | 最低系統版本要求 | ||
| MaximumSystemVersion | 最高系統版本要求 | ||
| MinimumXXTVersion | 最低 XXTouch 版本要求 | ||
| SupportedResolutions | 裝置分辨率支援陣列 | ||
| PackageControl | 附加資訊 |
建議盡可能完善這些資訊。完善的顯示名稱、應用圖示和設定介面有助於提升腳本的整體觀感與認可度。
在腳本中,取得 Info.lua 中的常量資訊,可通過 XPP 腳本包模組 取得。
XPP 腳本包支援哪些腳本?
XPP 腳本包支援的可執行腳本格式為 .lua 和 .xxt。腳本從腳本包中取得資源與設定,與單獨運行並無顯著區別。如需指定入口腳本,參見 Info.lua 的 Executable 字段。
如何指定 XPP 的設定介面?
如需指定 XPP 腳本包設定時的設定介面檔案,參見 Info.lua 的 MainInterfaceFile 字段。如需編寫設定介面 XUI 檔案,參見 XUI 介面庫使用手冊.
如何處理 XPP 中的資源?
- XPP 腳本包中的腳本/資源/模組/資料需放置於 XPP 目錄中,通過相對路徑訪問。
- XPP 腳本包運行時所產生的臨時檔案/資料,請勿存放在 XPP 腳本包中,應存放於 XXTouch 快取目錄、臨時目錄等位置。
在腳本中,XPP 腳本包中的資源路徑,可通過 XPP 腳本包模組 取得。