跳至主要內容

讀取屬性表檔案 (plist.read)

聲明

關聯表 = plist.read(檔案路徑)

參數

  • 檔案路徑
    文字型,需要讀取的 plist 檔案的絕對路徑

回傳值

  • 關聯表
    表型 或 nil,讀取成功則返回 plist 的樹形結構對應的一個表,否則返回 nil

說明

讀取 plist 檔案轉換成表
plist 檔案中的非通用資料類型值不支援讀取,會被忽略
該函式可在 XUI 中使用

範例

local plist = require("plist")
local plfilename = "/var/mobile/Library/Caches/com.apple.mobile.installation.plist" --設置plist路徑
local tmp2 = plist.read(plfilename) --讀取plist文件內容並返回一個TABLE
sys.alert(tmp2['Metadata']['ProductBuildVersion']) --顯示ProductBuildVersion的鍵值

:上述代碼中使用了非本章函式 sys.alert