Package

Tip

This is a Static Class named Package. You can access it’s methods directly with :. It is not possible to initialize or create new instances.

Functions

Returns

Name

Description

any

Call(string package_name, string function_name, table {args…})

Calls an exported function from an other Package

Export(string function_name, function function)

‘Exports’ a function to be called from any other Package

Log(string Message)

Logs a message in the console (the proper and Nanos way)

Require(string ScriptFile)

Includes new .lua files

RequirePackage(string PackageName)

Includes other Package in this Package

table<string>

GetFiles(string PathFilter = “”, string ExtensionFilter = “”)

Gets a list of all files in this package, optionally with filters

string

GetName()

Gives the package name

string

GetPath()

Gives the package path

Events

Name

Arguments

Description

Load

Is called as soon as a package is loaded.

Unload

Is called as soon as a package is unloaded.

Examples

-- prints the package name at the "Load" event
Package:on("Load", function()
  print("Load package: " .. Package:GetName())
end)

-- prints the package name at the "Unload" event
Package:on("Unload", function()
  print("Unload package: " .. Package:GetName())
end)