Field¶
Global · Field · server and client scripts
Field builds typed field and signal parameter descriptors for World.DefineComponent and Net message definitions. Plain default values in fields also define primitive fields directly: number, boolean, string, vector (Vector3), Vector2, Color, Rotation, and UIVector.
Entity¶
Entity declares an optional entity reference field. Call Field.Entity({ OnTargetDestroyed = "Clear" }) to clear the reference automatically when the target entity is destroyed, or "Keep" to retain the dead handle.
Example
List¶
List declares a variable-length array field whose elements match the item template item.
Example
Enum¶
Enum declares a string field restricted to the allowed values list, with initial value default.
Example
Optional¶
Optional declares a nullable field that holds either a value matching item or nil.
Example
Buffer¶
Buffer declares a binary buffer field capped at maxBytes bytes for Net message definitions. Components do not accept Field.Buffer; use a Store or a Net event for binary data.
Example
Arg¶
Arg names a single parameter in a component's ComponentOptions.Signals declaration, pairing parameter name with an item template item.