Lua 例程

Lua API

通过编写 Lua 场景调用 Lua API 来控制任务运行

scene(10087)

SDK

通过下载安装 SDK 来控制任务运行

local lebai_sdk = require('lebai_sdk')
lebai_sdk.init()

local function main()
    -- 设备发现
    print(lebai_sdk.discover_devices(2))

    local lebai = lebai_sdk.connect("127.0.0.1", false)
    lebai:start_sys()
    lebai:start_task("10087", nil, nil, false, 1)
end

local co = coroutine.create(main)
while coroutine.status(co) ~= "dead" do
  local success, error_message = coroutine.resume(co)
  if not success then
    print("Error in coroutine: ")
    print(error_message)
  end
end