# supply.sprak
Library for supplying connections.

## Usage
* Once in a while, keep re-runnning the "skip.sprak" script until completion to update the list of types and things to skip.
* Don't use on "FinanceComputer" or "PoliceOfficeInterior_MinistryOfficeWorkstationComputer_1".
* May fail if the thing containing the function found is the same thing that is programmed with this program. `Name()` function isn't used to detect this as that isn't available in all things. Use `overrides` to skip these things instead.

## Functions
### Imports
* serde.sprak
	* `deserialise`
* equality.sprak
* array.sprak
	* `has`
* types.sprak
	* `Left`
	* `Right`

### `supplier_of`
Returns `Either(string, string)` where `Right` is the name of a thing that supplies the input function if anything in the game world is able to supply the function, and `Left` is a error message about what caused the failure. If it hasn't yet been cached, the thing that supplies the function is then saved in the memory of "FinanceComputer" (or the thing overriding it) using the name of the function as key to speed up later access to the same function.
#### Type
`["MemoryAPI"?: string, "TingrunnerAPI"?: string, "skip_types"?: [string], "skip_things"?: [string], "more_skip_types"?: [string], "more_skip_things"?: [string]] -> string -> Either(string, string)`
#### Arguments
* `overrides`: `array` that may contain data to replace or supplement variables used by the function.
* `function`: Function to find a supplier of.
#### Examples
```sprak
array array_buffer = supplier_of([], "IsNight")
string supplier = array_buffer[1]
Say(Connect(supplier).IsNight())
```

### `supplier_of_unwrapped`
Returns a `string` representing the name of a thing that supplies the input function. If it hasn't yet been cached, the thing that supplies the function is then saved in the memory of "FinanceComputer" (or the thing overriding it) using the name of the function as key to speed up later access to the same function. May fail silently if nothing in the game world is able to supply the function.
#### Type
`["MemoryAPI"?: string, "TingrunnerAPI"?: string, "skip_types"?: [string], "skip_things"?: [string], "more_skip_types"?: [string], "more_skip_things"?: [string]] -> string -> string`
#### Arguments
* `overrides`: `array` that may contain data to replace or supplement variables used by the function.
* `function`: Function to find a supplier of.
#### Examples
```sprak
string supplier = supplier_of_unwrapped([], "IsNight")
Say(Connect(supplier).IsNight())
```

### `supply`
Returns `Either(string, number)` where `Right` is the connection to a thing that supplies the input function if anything in the game world is able to supply the function, and `Left` is an error message about what caused the failure. If it hasn't yet been cached, the thing that supplies the function is then saved in the memory of "FinanceComputer" (or the thing overriding it) using the name of the function as key to speed up later access to the same function.
#### Type
`["MemoryAPI"?: string, "TingrunnerAPI"?: string, "skip_types"?: [string], "skip_things"?: [string], "more_skip_types"?: [string], "more_skip_things"?: [string]] -> string -> Either(string, number)`
#### Arguments
* `overrides`: `array` that may contain data to replace or supplement variables used by the function.
* `function`: Function to find a connection for.
#### Examples
```sprak
array array_buffer = supply([], "IsNight")
number connection = array_buffer[1]
Say(connection.IsNight())
```

### `supply_unwrapped`
Returns a `number` representing the connection to a thing that supplies the input function. If it hasn't yet been cached, the thing that supplies the function is then saved in the memory of "FinanceComputer" (or the thing overriding it) using the name of the function as key to speed up later access to the same function. May fail silently if nothing in the game world is able to supply the function.
#### Type
`["MemoryAPI"?: string, "TingrunnerAPI"?: string, "skip_types"?: [string], "skip_things"?: [string], "more_skip_types"?: [string], "more_skip_things"?: [string]] -> string -> number`
#### Arguments
* `overrides`: `array` that may contain data to replace or supplement variables used by the function.
* `function`: Function to find a connection for.
#### Examples
```sprak
string connection = supply_unwrapped([], "IsNight")
Say(connection.IsNight())
```