Log inGet started
Package

shared.module

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

shared Module

Helpers more than one tool in the client toolbox uses. A tool inside this toolbox pulls them in with require(".shared").

Purpose

A sub-client starts in the background: its row reads starting until it can answer, then ready, or failed with its reason. The create and restart tools wait on that row through awaitStarted, so a caller can wait for the sub-client it just started before its first call.

Usage

local Shared = require(".shared")

-- `request` sends one op to the sub-client host and returns its row.
local row = Shared.awaitStarted(request, id, 60)
if row.state == "failed" then
    error("client: " .. tostring(row.reason))
end

Exports

  • Shared.awaitStarted(request, id?, timeoutSeconds?): reads the row of the sub-client id names (the caller's own when id is nil) every 0.25 s until it leaves starting, and returns the row it ended on. Raises naming the sub-client, the time waited and its reason when it is still starting after timeoutSeconds.
  • Shared.DEFAULT_TIMEOUT_SECONDS: the wait used when the caller states none, 20 minutes.