ProgramService
Up and coming: shot check knows this class and its members today, and programs run it once the native runtime lands.
Up and coming
Your running program itself: its arguments, environment, standard folders, a data folder of its own and a clean way to end.
use ProgramService gives it. BindToClose callbacks run before the program ends, all of them together within 10 s, as with Roblox's game:BindToClose. AcquireLockAsync takes a ProgramLock every program on the computer shares, and CreateJobQueue makes a JobQueue.
A service: write use ProgramService.
Properties
| Name | Type | Default | Description |
|---|---|---|---|
| Arguments | { string } | What followed the project on the command line, as in shot run MyProject.shotsystem -- --quiet. | |
| ProjectPath | string | The .shotsystem file that is running. | |
| WorkingFolder | string | ||
| DataFolder | PathHandler | A folder of this program's own for settings, logs and caches, named after the project in %LOCALAPPDATA%/ShotSystem and made on first use. | |
| UserName | string | ||
| ComputerName | string | ||
| StartAtLogon | boolean | Whether the program starts by itself, hidden, when you log on. |
Methods
| Name | Arguments | Returns | Description |
|---|---|---|---|
| GetEnvironmentVariable | (name: string) | string? | |
| GetEnvironment | () | { [string]: string } | |
| GetKnownFolder | (name: "Home" | "Temp" | "AppData" | "LocalAppData" | "Desktop" | "Documents") | PathHandler | |
| BindToClose | (callback: (reason: CloseReason) -> ()) | () | Runs the callback with why the program ends ("Exit", "Stop", "Error" or "Ended"); all callbacks together get up to 10 s. |
| ExitAsync yields | (code: number?) | () | Runs the BindToClose callbacks, then ends the program with the code, 0 by default. |
| SingleInstanceAsync yields | (name: string) | boolean | |
| RegisterCommand | (name: string, callback: (args: { string }) -> (string, number)) | () | Answers a named command that another process sends this program, with that command's arguments. |
| IdleSeconds | () | number | Seconds since your last input on this computer. |
| AcquireLockAsync yields | (name: string, timeout: number?) | (ProgramLock?, string?) | Takes a named lock every program on the computer shares, waiting up to timeout seconds (0 by default); otherwise nil and who holds it. |
| IsLockHeldAsync yields | (name: string) | (boolean, number?) | Whether a named lock is held, and the holder's pid. |
| CreateJobQueue | (name: string, maxRunning: number) | JobQueue | Makes a JobQueue that runs at most maxRunning jobs at a time. |
Events
| Name | Passes | Description |
|---|---|---|
| InputLine | (string) | Fires with each line written to this program's input, from a terminal or from a program driving it. |
| StopRequested | () |
From ShotInstance 33
ClassNameNameParentAncestryChangedAttributeChangedChangedChildAddedChildRemovedDestroyingAddTagClearAllChildrenCloneDestroyFindFirstAncestorFindFirstAncestorOfClassFindFirstAncestorWhichIsAFindFirstChildFindFirstChildOfClassFindFirstChildWhichIsAGetAttributeGetAttributeChangedSignalGetAttributesGetChildrenGetDescendantsGetFullNameGetPropertyChangedSignalGetTagsHasTagIsAIsAncestorOfIsDescendantOfRemoveTagSetAttribute
