luascript

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2026 License: Apache-2.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package luascript runs the hub Lua scripts shared by the Android and iOS devices. The platform specific parts (finding elements, tapping, typing, alerts) are supplied as small strategy interfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alerts

type Alerts interface {
	AlertText() (string, error)
}

Alerts reads the text of the visible system alert.

type Clicker

type Clicker interface {
	Click(lookupType, lookup string) error
}

Clicker taps the element a lookup describes. A returned error is raised in the script.

type Clock

type Clock interface {
	Now() time.Time
	After(d time.Duration) <-chan time.Time
}

Clock is the time source of the wait loops.

func SystemClock

func SystemClock() Clock

SystemClock is the wall clock.

type Deps

type Deps struct {
	Finder   Finder
	Clicker  Clicker
	Keyboard Keyboard
	Alerts   Alerts
	Logger   Logger
	Clock    Clock
}

Deps are the strategies a Handler needs. Alerts is optional: without it the script function waitForAlertWith is not registered.

type Finder

type Finder interface {
	Find(lookupType, lookup string) (bool, error)
}

Finder looks up an element on the device screen.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler executes hub Lua scripts against a device.

func New

func New(deps Deps) *Handler

New creates a Handler from its strategies.

func (*Handler) Execute

func (h *Handler) Execute(script string) error

Execute runs the script. gopher-lua turns a panic inside a script function into the returned error, so no recover is needed here.

type Keyboard

type Keyboard interface {
	SendText(text string) error
}

Keyboard types text into the focused element.

type Logger

type Logger interface {
	Log(tag, format string, args ...interface{})
	Error(tag, format string, args ...interface{})
}

Logger writes to the device log.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL