Data type
SharedTable
Provides sharable, table-like storage for key/value pairs.
About SharedTable
Represents a table-like data structure that can be shared across execution
contexts. While it can be used for various sorts of general data storage, it
is designed especially for use with
Parallel Luau, where it can be used to
share state across scripts parented under different Actor instances.
There are a couple idiomatic ways to communicate shared tables between
scripts. One method is to store and retrieve SharedTable objects in
the SharedTableRegistry. The registry lets any script in the same data
model get or set a SharedTable by name. Another method is to use
Actor.SendMessage to send a shared table to another Actor
inside a message.
Like a Luau table, a SharedTable object stores a set of key-value
element pairs. Unlike a Luau table, only selected types of objects may be
stored in a SharedTable, similar to other restrictions you'll find elsewhere
in the Roblox Engine.
Keys must either be (1) a string or (2) a nonnegative integer number less than 232. Other kinds of keys are not supported.
Values must have one of the following types: Boolean, Number, Vector, String,
SharedTable, or a serializable data type. The ability to store a
SharedTable as a value in another SharedTable permits
the construction of nested and recursive data structures.
SharedTable objects are distinct and different
SharedTable objects never compare equal, even if they have contents
that would compare equal.
Like a Luau table, a SharedTable object may be frozen, in which
case it is read-only. An attempt to modify a frozen SharedTable
will raise an error. A frozen SharedTable can be created by first
creating a (non-frozen, modifiable) SharedTable with the desired
contents, and then calling SharedTable.cloneAndFreeze to create a
frozen clone of it.
Constructors 2
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.