📦 Package
Class which represents the current Package
🗿Static Class
This is a Static Class. Access it's methods directly with
.
. It's not possible to spawn new instances.🧑💻API Source
This page is auto-generated! The Functions, Properties and Events described here are defined in our GitHub's API Repository! Feel free to commit suggestions and changes to the source .json API files!
🗿 Static Functions
Returns | Name | Description | |
---|---|---|---|
![]() | Export | Makes any variable available in the global scope | |
![]() | FlushPersistentData | Flushes the Persistent Data pending changes to disk immediately | |
![]() | string | GetCompatibilityVersion | Returns the package compatibility version |
![]() | table of string | GetDirectories | Gets a list of all directories in this package |
![]() | table of string | GetFiles | Gets a list of all files in this package |
![]() | string | GetName | Returns the package name/path |
![]() | table | GetPersistentData | Gets the Persistent Value from the disk |
![]() | string | GetTitle | Returns the package title |
![]() | string | GetVersion | Returns the package version |
![]() | any | Require | Includes new .lua files |
![]() | SetPersistentData | Sets a Persistent Value which will be saved to disk | |
![]() | function | Subscribe | Subscribes to an Event |
![]() | Unsubscribe | Unsubscribes from all subscribed Events in this Class and in this Package, optionally passing the function to unsubscribe only that callback |

Export
Makes any variable available in the global scope
Package.Export(variable_name, value)
Type | Parameter | Default | Description |
---|---|---|---|
string | variable_name | Required parameter | Name of the variable to export |
any | value | Required parameter | Value to be set in the global scope |

FlushPersistentData
Flushes the Persistent Data pending changes to disk immediately
Package.FlushPersistentData()

GetCompatibilityVersion
Returns the package compatibility version
— Returns string (The package compatibility version).
local ret = Package.GetCompatibilityVersion()

GetDirectories
Gets a list of all files in this package, optionally with filters
— Returns table of string (List of directories).
local ret = Package.GetDirectories(path_filter?)
Type | Parameter | Default | Description |
---|---|---|---|
string | path_filter? |
| Path filter |

GetFiles
Gets a list of all files in this package, optionally with filters
— Returns table of string (List of files).
local ret = Package.GetFiles(path_filter?, extension_filter?)
Type | Parameter | Default | Description |
---|---|---|---|
string or table | path_filter? |
| Path filter |
string | extension_filter? |
| Example: .lua |

GetName
Returns the package name/path
— Returns string (The package name/path).
local ret = Package.GetName()

GetPersistentData
Gets the Persistent Value from the disk
— Returns table (Persistent values from disk).
local ret = Package.GetPersistentData(key?)
See also SetPersistentData.

GetTitle
Returns the package title
— Returns string (The package title).
local ret = Package.GetTitle()

GetVersion
Returns the package version
— Returns string (The package version).
local ret = Package.GetVersion()

Require
Includes new .lua files
We currently support 5 searchers, which are looked in the following order:
- Relative to
current-file-path/
- Relative to
current-package/Client/
orcurrent-package/Server/
(depending on your side)- Relative to
current-package/Shared/
- Relative to
current-package/
- Relative to
Packages/
— Returns any (Any return values from the included file).
local ret = Package.Require(script_file, force_load)
Type | Parameter | Default | Description |
---|---|---|---|
string | script_file | Required parameter | Path to the script file to require |
boolean or nil | force_load | Required parameter | Whether to force loading this file even if it was already loaded |

SetPersistentData
Sets a Persistent Value which will be saved to disk
Package.SetPersistentData(key, value)
Type | Parameter | Default | Description |
---|---|---|---|
string | key | Required parameter | Key to index data into |
any | value | Required parameter | Value to set at the key |
See also GetPersistentData.

Subscribe
Subscribes to an Event
— Returns function (The function callback).
local ret = Package.Subscribe(event_name, callback)
Type | Parameter | Default | Description |
---|---|---|---|
string | event_name | Required parameter | Event to subscribe to |
function | callback | Required parameter | Callback to run on the event occurring |

Unsubscribe
Unsubscribes from all subscribed Events in this Class and in this Package, optionally passing the function to unsubscribe only that callback
Package.Unsubscribe(event_name, callback?)
Type | Parameter | Default | Description |
---|---|---|---|
string | event_name | Required parameter | Event to unsubscribe to |
function | callback? | nil | Optional callback to specifically unsubscribe to |
🚀 Events

Load
Called when this package is loaded
This event is triggered differently depending on the situation:
- When the server starts or you run
package reload all
the event triggers only after ALL packages are loaded.- In all other cases (
package load/reload
orPackage.Load/Reload
) the event is triggered immediately after the package is loaded/reloaded.
Package.Subscribe("Load", function()
-- Load was called
end)

Unload
Called when this package is unloaded
Package.Subscribe("Unload", function()
-- Unload was called
end)