跳至主要內容

等待人工輔助結果 (LCC.assist.wait)

聲明​

result, err, task = LCC.assist.wait(id, timeout?, pollIntervalMs?)

參數​

  • id
    字串型,輔助請求 ID。
  • timeout
    數值型,可選;等待秒數,預設 300。
  • pollIntervalMs
    數值型,可選;輪詢間隔毫秒,預設 1000,小於 250 會按 250 處理。

回傳值​

  • result
    表格型或 nil;任務進入 submitted 時傳回提交結果。
  • err
    字串型或 nil;失敗時傳回錯誤描述。
  • task
    表格型或 nil;最後一次任務狀態。

說明​

輪詢中控端任務狀態,直到任務提交、取消、過期、找不到或等待逾時。
等待逾時時,SDK 會嘗試撤銷本次請求並傳回 nil, "timeout", task。
只有 submitted 狀態會傳回 result。

範例​

local result, err, task = LCC.assist.wait("assist_xxx", 300, 1000)
if result then
nLog("輔助完成")
else
nLog("輔助失敗", err, task and task.status)
end