📘 BaseClass
BaseClass is the class from which all ClassLib classes inherits
Last updated
Was this helpful?
BaseClass is the class from which all ClassLib classes inherits
Last updated
Was this helpful?
GetAll
Returns all instances from this class
— Returns (Table of all instances of the class)
GetCount
Returns how many instances of this class exists
GetByID
Returns an instance of this class from the instance unique ID
iID
The instance ID
GetParentClass
Returns the class from which this class inherits
GetAllParentClasses
Returns a sequential table of all classes from which this class inherits
GetInheritedClasses
Returns a sequential table of all classes that inherit from this class
Inherit
Creates a new class that inherits from this class
sClassName
The name of the new class
bSync?
false
Whether to sync the creation/destruction of an instance of the class to all players
ClassCall
Calls an event on the class
sEvent
The name of the event to call
...?
The arguments to pass to the event
ClassSubscribe
Subscribes to an Event on the Class
sEvent
The name of the event to listen to
callback
The callback to call when the event is triggered, return false
to unsubscribe from the event
ClassUnsubscribe
Unsubscribes from all subscribed Events on this Class, optionally passing the function to unsubscribe only that callback
sEvent
The name of the event to unsubscribe to
callback?
The callback to unsubscribe, or nil
to unsubscribe to all events with the same name
SubscribeRemote
Subscribes to a remote event
sEvent
The name of the event to unsubscribe to
callback
The callback to call when the event is triggered, return false
to unsubscribe from the event
UnsubscribeRemote
Unubscribes to a remote event
sEvent
The name of the event to unsubscribe to
callback?
The callback to unsubscribe, or nil
to unsubscribe to all events with the same name
Constructor
Called after an instance of the class is created
...?
The arguments to passed to the contructor when calling MyClass()
as a function
Destructor
Called when an instance is about to be destroyed
...?
The arguments to passed to the contructor when calling my_instance:Destroy()
Sets a key/value on the instance
sKey
Key
xValue?
Value
bBroadcast?
Whether to broadcast the key/value to all clients (server only)
Gets a key/value from the instance
sKey
Key
xFallback?
Fallback value (if the key doesn't exist)
Returns all the values of the instance set by SetValue
bBroadcastedOnly
false
Wether to only return broadcasted values
Returns wether a key has it's value is broadcasted
sKey
Key
Call
Calls an Event on the instance
sEvent
The name of the event to call
...?
The arguments to pass to the event
Subscribe
Subscribes to an Event on the instance
sEvent
The name of the event to listen to
callback
The callback to call when the event is triggered, return false
to unsubscribe from the event
Unsubscribe
Unsubscribes from all subscribed Events in this instance, optionally passing the function to unsubscribe only that callback
sEvent
The name of the event to unsubscribe to
callback?
The callback to unsubscribe, or nil
to unsubscribe to all events with the same name
CallRemote
Calls a remote event, from the client to the server, or from the server to the client
sEvent
The name of the event to call
...?
The arguments to pass to the event
BroadcastRemote
Broadcast a remote event from the server to all clients
sEvent
The name of the event to broadcast
...?
The arguments to pass to the event
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
tIgnoredKeys?
The properties to ignore (must be a sequential table)
...?
The arguments to pass to the constructor
Destroy
Destroys the instance
...?
Arguments to pass to the destructor
GetClass
Returns the class table of the instance
GetClassName
Returns the class name of the instance
GetID
Returns the ID of the instance
Checks if the instance is from a passed class, or from a class that inherits from the passed class
tClass
The class to check
bRecursive?
false
Wether to check recursively
IsValid
Checks if the instance is valid
IsBeingDestroyed
Checks if the instance is being destroyed
Super
Returns the class from which this instance class inherits
SuperAll
Returns a sequential table of all classes from which this instance inherits
ClassRegister
Called when a new class is inherited from this class
tInheritedClass
The instance that was spawned
Spawn
Triggered when an instance is created
self
The instance that was spawned
Destroy
Triggered when an instance is about to be destroyed
self
The instance that is about to be destroyed
ValueChange
— Returns (Amount of instances of the class)
— Returns (The instance, or nil
if it doesn't exist)
— Returns (The super class)
— Returns (The super classes)
— Returns (The inherited classes)
— Returns (The new class)
To synchronize instances of a class you must your class on the side and spawn/destroy your instances on the 🟦 side
— Returns (The callback)
— Returns
— Returns (The callback)
If called from the 🟦 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)
— Returns (The new instance)
— Returns
— Returns (The class name)
— Returns (Amount of instances of the class)
— Returns
— Returns (Wether the instance is valid)
— Returns (Wether the instance is being destroyed)
— Returns (The parent class)
— Returns (The list of parent classes)
instance
instance
Triggered when an instance has a value changed with