Skip to main content

Getting Started

Welcome to the TV Labs Lua Scripting API documentation! Whether you're new to automation or an experienced developer, this guide covers the essentials for automating TV device testing and interaction.

Our scripting environment is built on Lua, combining its simplicity with specialized modules for streaming service development and QA. These modules handle video analysis, automation, device control, and spatial navigation.

🚀 Quick Start​

control.home()
wait(2000)
local screenshot = screen.capture()
print("Screenshot captured!")
print(screenshot)

Key Features​

The TV Labs Lua API provides comprehensive automation capabilities for TV device testing:

  • Control devices using remote control commands (control.ok(), control.left(), etc.)
  • Capture and analyze screens using computer vision (wait.forScreen(), screen.capture())
  • Wait for conditions like screen changes or specific content
  • Test workflows with structured test cases using describe() and it()
  • Measure performance with built-in timing and metrics
  • AI-powered automation with ai.prompt() and ai.navigate()

Module-Based Architecture​

Our API is organized into intuitive namespaces:

-- Remote control
control.ok()
control.left()
control.home()

-- Screen capture
local frame = screen.capture()
local screenType = screen.type()

-- Timing and conditions
wait(1000)
wait.forScreen("Loading", { timeout = 10000 })
wait.forMotion("start", { timeout = 5000 })

-- AI automation
local response = ai.prompt("Describe what you see")
ai.navigate("Search button")

-- Metrics
metric.record("app_start_time", time)

Next Steps​

Ready to dive deeper? Follow this learning path:

  1. Vision Scripting Guide - Learn screen detection and visual automation
  2. Writing Your First Test - Test structure and organization
  3. Test Patterns - Complete examples for common scenarios

Each guide builds on the previous one, taking you from basic concepts to advanced automation patterns.

API Reference​

For complete function reference and advanced features: Lua API Reference - Complete documentation of all available modules and functions