📘 BaseClass
BaseClass is the class from which all ClassLib classes inherits
🗿 Static Functions
GetAll
GetAll
Returns all instances from this class
— Returns table (Table of all instances of the class)
GetCount
GetCount
Returns how many instances of this class exists
— Returns integer (Amount of instances of the class)
GetByID
GetByID
Returns an instance of this class from the instance unique ID
— Returns table (The instance, or nil
if it doesn't exist)
Type | Name | Default | Description |
---|---|---|---|
| The instance ID |
GetParentClass
GetParentClass
Returns the class from which this class inherits
— Returns table (The super class)
GetAllParentClasses
GetAllParentClasses
Returns a sequential table of all classes from which this class inherits
— Returns table (The super classes)
GetInheritedClasses
GetInheritedClasses
Returns a sequential table of all classes that inherit from this class
— Returns table (The inherited classes)
Inherit
Inherit
Creates a new class that inherits from this class
— Returns table (The new class)
Synchronized instances will be networked to new players even if the instance was created before they were connected on the server
Type | Name | Default | Description |
---|---|---|---|
| The name of the new class | ||
|
| Whether to sync the creation/destruction of an instance of the class to all players |
ClassCall
ClassCall
Calls an event on the class
Type | Name | Default | Description |
---|---|---|---|
| The name of the event to call | ||
| The arguments to pass to the event |
ClassSubscribe
ClassSubscribe
Subscribes to an Event on the Class
— Returns function (The callback)
Return false
in the callback to unsubscribe from the event after the listener has been triggered
Type | Name | Default | Description |
---|---|---|---|
| The name of the event to listen to | ||
| The callback to call when the event is triggered, return |
ClassUnsubscribe
ClassUnsubscribe
Unsubscribes from all subscribed Events on this Class, optionally passing the function to unsubscribe only that callback
Type | Name | Default | Description |
---|---|---|---|
| The name of the event to unsubscribe to | ||
| The callback to unsubscribe, or |
SubscribeRemote
SubscribeRemote
Subscribes to a remote event
Type | Name | Default | Description |
---|---|---|---|
| The name of the event to unsubscribe to | ||
| The callback to call when the event is triggered, return |
UnsubscribeRemote
UnsubscribeRemote
Unubscribes to a remote event
Type | Name | Default | Description |
---|---|---|---|
| The name of the event to unsubscribe to | ||
| The callback to unsubscribe, or |
🦠 Methods
Constructor
Constructor
Called after an instance of the class is created
Type | Name | Default | Description |
---|---|---|---|
| The arguments to passed to the contructor when calling |
Destructor
Destructor
Called when an instance is about to be destroyed
Return false
in the destructor to prevent an instance from being destroyed
Type | Name | Default | Description |
---|---|---|---|
| The arguments to passed to the contructor when calling |
SetValue
Sets a key/value on the instance
Type | Name | Default | Description |
---|---|---|---|
| Key | ||
| Value | ||
| Whether to broadcast the key/value to all clients (server only) |
GetValue
Gets a key/value from the instance
GetAllValuesKeys
Returns all the values of the instance set by SetValue
Type | Name | Default | Description |
---|---|---|---|
|
| Wether to only return broadcasted values |
IsValueBroadcasted
Returns wether a key has it's value is broadcasted
— Returns boolean
Type | Name | Default | Description |
---|---|---|---|
| Key |
Call
Call
Calls an Event on the instance
Type | Name | Default | Description |
---|---|---|---|
| The name of the event to call | ||
| The arguments to pass to the event |
Subscribe
Subscribe
Subscribes to an Event on the instance
— Returns function (The callback)
Return false
in the callback to unsubscribe from the event after the listener has been triggered
Type | Name | Default | Description |
---|---|---|---|
| The name of the event to listen to | ||
| The callback to call when the event is triggered, return |
Unsubscribe
Unsubscribe
Unsubscribes from all subscribed Events in this instance, optionally passing the function to unsubscribe only that callback
Type | Name | Default | Description |
---|---|---|---|
| The name of the event to unsubscribe to | ||
| The callback to unsubscribe, or |
CallRemote
CallRemote
Calls a remote event, from the client to the server, or from the server to the client
Type | Name | Default | Description |
---|---|---|---|
| The name of the event to call | ||
| The arguments to pass to the event |
If called from the 🟦 Server side, the 2nd argument is the player (or table of players) to which to send the event (in this case the varargs will start from 3rd argument instead of 2nd)
BroadcastRemote
BroadcastRemote
Broadcast a remote event from the server to all clients
Type | Name | Default | Description |
---|---|---|---|
| The name of the event to broadcast | ||
| The arguments to pass to the event |
Clone
Clone
Clones the instance, and return the new clone with the same values (except it's ID)
Optionally, you can ignore some properties, so they won't be copied
— Returns table (The new instance)
Type | Name | Default | Description |
---|---|---|---|
| The properties to ignore (must be a sequential table) | ||
| The arguments to pass to the constructor |
Destroy
Destroy
Destroys the instance
Type | Name | Default | Description |
---|---|---|---|
| Arguments to pass to the destructor |
GetClass
GetClass
Returns the class table of the instance
— Returns table
GetClassName
GetClassName
Returns the class name of the instance
— Returns string (The class name)
GetID
GetID
Returns the ID of the instance
— Returns integer (Amount of instances of the class)
The ID is unique to it's class, and won't be re-used if the object gets destroyed
IsA
Checks if the instance is from a passed class, or from a class that inherits from the passed class
— Returns boolean
You can also call ClassLib.IsA(xAnyValue, tClass, bRecursive?)
Type | Name | Default | Description |
---|---|---|---|
| The class to check | ||
|
| Wether to check recursively |
IsValid
IsValid
Checks if the instance is valid
— Returns boolean (Wether the instance is valid)
IsBeingDestroyed
IsBeingDestroyed
Checks if the instance is being destroyed
— Returns boolean (Wether the instance is being destroyed)
Super
Super
Returns the class from which this instance class inherits
— Returns table (The parent class)
SuperAll
SuperAll
Returns a sequential table of all classes from which this instance inherits
— Returns table (The list of parent classes)
🚀 Events
ClassRegister
ClassRegister
Called when a new class is inherited from this class
Type | Argument | Description |
---|---|---|
| The instance that was spawned |
Spawn
Spawn
Triggered when an instance is created
Type | Argument | Description |
---|---|---|
BaseClass instance |
| The instance that was spawned |
Destroy
Destroy
Triggered when an instance is about to be destroyed
Type | Argument | Description |
---|---|---|
BaseClass instance |
| The instance that is about to be destroyed |
ValueChange
ValueChange
Triggered when an instance has a value changed with :SetValue()
Last updated