Appearance
ReactiveStateSchema
Inherits: Class
Methods
AddBooleanField
lua
function ReactiveStateSchema:AddBooleanField(key, default)
-> selfDefines a boolean field as part of the schema.
Parameters:
| Name | Type | Description |
|---|---|---|
key | string | The key of the new field |
default | boolean | The default value of the field |
Returns:
| Type | Description |
|---|---|
self |
AddDeferredBooleanField
lua
function ReactiveStateSchema:AddDeferredBooleanField(key)
-> selfDefines a boolean field as part of the schema which can be nil (and is by default) but is defined with a non-nil assertion for the language server.
Parameters:
| Name | Type | Description |
|---|---|---|
key | string | The key of the new field |
Returns:
| Type | Description |
|---|---|
self |
AddDeferredClassField
lua
function ReactiveStateSchema:AddDeferredClassField(key, class)
-> selfDefines an optional class field as part of the schema which can be nil (and is by default) but is defined with a non-nil assertion for the language server.
Parameters:
| Name | Type | Description |
|---|---|---|
key | string | The key of the new field |
class | T | T | The class or name of the class (subclasses are not permitted in the later case) |
Returns:
| Type | Description |
|---|---|
self |
AddDeferredEnumField
lua
function ReactiveStateSchema:AddDeferredEnumField(key, enumType)
-> selfDefines an enum field field as part of the schema which can be nil (and is by default) but is defined with a non-nil assertion for the language server.
Parameters:
| Name | Type | Description |
|---|---|---|
key | string | The key of the new field |
enumType | EnumObject | The enum type |
Returns:
| Type | Description |
|---|---|
self |
AddDeferredNumberField
lua
function ReactiveStateSchema:AddDeferredNumberField(key, validateFunc)
-> selfDefines a number field as part of the schema which can be nil (and is by default) but is defined with a non-nil assertion for the language server.
Parameters:
| Name | Type | Description |
|---|---|---|
key | string | The key of the new field |
validateFunc | fun(value: number): boolean | A function used to validate values |
Returns:
| Type | Description |
|---|---|
self |
AddDeferredStringField
lua
function ReactiveStateSchema:AddDeferredStringField(key, validateFunc)
-> selfDefines a string field as part of the schema which can be nil (and is by default) but is defined with a non-nil assertion for the language server.
Parameters:
| Name | Type | Description |
|---|---|---|
key | string | The key of the new field |
validateFunc | fun(value: string): boolean | A function used to validate values |
Returns:
| Type | Description |
|---|---|
self |
AddDeferredTableField
lua
function ReactiveStateSchema:AddDeferredTableField(key, validateFunc)
-> selfDefines a table field as part of the schema which can be nil (and is by default) but is defined with a non-nil assertion for the language server.
Parameters:
| Name | Type | Description |
|---|---|---|
key | string | The key of the new field |
validateFunc | fun(value: table): boolean | A function used to validate values |
Returns:
| Type | Description |
|---|---|
self |
AddEnumField
lua
function ReactiveStateSchema:AddEnumField(key, enumType, default)
-> selfDefines an enum field as part of the schema.
Parameters:
| Name | Type | Description |
|---|---|---|
key | string | The key of the new field |
enumType | EnumObject | The enum type |
default | EnumValue | The default value of the field |
Returns:
| Type | Description |
|---|---|
self |
AddNumberField
lua
function ReactiveStateSchema:AddNumberField(key, default, validateFunc)
-> selfDefines a number field as part of the schema.
Parameters:
| Name | Type | Description |
|---|---|---|
key | string | The key of the new field |
default | number | The default value of the field |
validateFunc | fun(value: number): boolean | A function used to validate values |
Returns:
| Type | Description |
|---|---|
self |
AddOptionalBooleanField
lua
function ReactiveStateSchema:AddOptionalBooleanField(key)
-> selfDefines a boolean field as part of the schema which can be nil (and is by default).
Parameters:
| Name | Type | Description |
|---|---|---|
key | string | The key of the new field |
Returns:
| Type | Description |
|---|---|
self |
AddOptionalClassField
lua
function ReactiveStateSchema:AddOptionalClassField(key, class)
-> selfDefines an optional class field as part of the schema which can be nil (and is by default).
Parameters:
| Name | Type | Description |
|---|---|---|
key | string | The key of the new field |
class | T | T | The class or name of the class (subclasses are not permitted in the later case) |
Returns:
| Type | Description |
|---|---|
self |
AddOptionalEnumField
lua
function ReactiveStateSchema:AddOptionalEnumField(key, enumType)
-> selfDefines an enum field as part of the schema which can be nil (and is by default).
Parameters:
| Name | Type | Description |
|---|---|---|
key | string | The key of the new field |
enumType | EnumObject | The enum type |
Returns:
| Type | Description |
|---|---|
self |
AddOptionalNumberField
lua
function ReactiveStateSchema:AddOptionalNumberField(key, validateFunc)
-> selfDefines a number field as part of the schema which can be nil (and is by default).
Parameters:
| Name | Type | Description |
|---|---|---|
key | string | The key of the new field |
validateFunc | fun(value: number): boolean | A function used to validate values |
Returns:
| Type | Description |
|---|---|
self |
AddOptionalStringField
lua
function ReactiveStateSchema:AddOptionalStringField(key, validateFunc)
-> selfDefines a string field as part of the schema which can be nil (and is by default).
Parameters:
| Name | Type | Description |
|---|---|---|
key | string | The key of the new field |
validateFunc | fun(value: string): boolean | A function used to validate values |
Returns:
| Type | Description |
|---|---|
self |
AddOptionalTableField
lua
function ReactiveStateSchema:AddOptionalTableField(key, validateFunc)
-> selfDefines a table field as part of the schema which can be nil (and is by default).
Parameters:
| Name | Type | Description |
|---|---|---|
key | string | The key of the new field |
validateFunc | fun(value: table): boolean | A function used to validate values |
Returns:
| Type | Description |
|---|---|
self |
AddStringField
lua
function ReactiveStateSchema:AddStringField(key, default, validateFunc)
-> selfDefines a string field as part of the schema.
Parameters:
| Name | Type | Description |
|---|---|---|
key | string | The key of the new field |
default | string | The default value of the field |
validateFunc | fun(value: string): boolean | A function used to validate values |
Returns:
| Type | Description |
|---|---|
self |
Commit
lua
function ReactiveStateSchema:Commit()
-> selfCommits the schema and prevents further changes.
Returns:
| Type | Description |
|---|---|
self |
CreateState
lua
function ReactiveStateSchema:CreateState()Creates a state object based on the schema.
Extend
lua
function ReactiveStateSchema:Extend(name)
-> selfReturns a new state schema which extends the existing one
Parameters:
| Name | Type | Description |
|---|---|---|
name | string | The name of the extended schema |
Returns:
| Type | Description |
|---|---|
self |
UpdateFieldDefault
lua
function ReactiveStateSchema:UpdateFieldDefault(key, default)
-> selfUpdates the default value of an existing field.
Parameters:
| Name | Type | Description |
|---|---|---|
key | string | The key of the field |
default | any | The default value of the field |
Returns:
| Type | Description |
|---|---|
self |
__tostring
lua
function ReactiveStateSchema:__tostring()Functions
Create
lua
function ReactiveStateSchema.Create(name)
-> ReactiveStateSchemaCreates a new state schema object.
Parameters:
| Name | Type | Description |
|---|---|---|
name | string | The name for debugging purposes |
Returns:
| Type | Description |
|---|---|
ReactiveStateSchema |