Lua Examples

Lua API

Control task execution by writing Lua scenes using Lua API

scene(10087)

SDK

Control task execution by downloading and installing the SDK

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

local function main()
    -- Device discovery
    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