shared.client - Windower/packages GitHub Wiki

This library facilitates sharing data between packages. Usually this refers to services and their respective libraries but can be just as well be used to communicate between different addons. The server module is used to create and host the data.

local client = require('shared.client')

Dependency Required

To use this library, you must include shared in the manifest.xml file for your package:

<dependency>shared</dependency>

Tables

The client table has the following entries:



client.new

Returns a new structure previously created in another addon or service.

Definition

function client.new(package_name : string, data_name : string) : struct

Parameters

package_name string

The name of the package where the shared object was created in.

data_name string

The name of the associated shared object. Can be (and is usually) omitted if the sharing package only uses one shared object. Needs to match the data_name specified in the server library.

Return

struct struct

The struct as defined on the server side.



client.configure

Sets up a deserialized ftype. Adds metatables to structs and arrays and creates the necessary typedefs. This is a very rarely used function and is not required when using client.new.

It is never needed when defining a struct directly, only when it is serialized and deserialized, since that process loses some information.

Definition

function client.configure(ftype : ftype)

Parameters

ftype ftype

The type description of the structure, defined via the struct library. In this case it is usually transmitted from the server to client vie the shared library or through events.

Return

This function does not return any values.

⚠️ **GitHub.com Fallback** ⚠️