AddFunctionExport

From Onset Developer Wiki
AddFunctionExport

Type: Function
Context: Server & Client
Introduced: v1.0

Description

Exports a function that can later be imported from another package.

Syntax

AddFunctionExport(ExportName, ExportFunction)

Parameters

  • ExportName
    Name of the export. Commonly the name of the exported function.
  • ExportFunction
    Function to export.

Return Value

  • Returns true on success. Return false if the export already exists.

Example

Package Test1

function UsefulFunc(param1, param2)
    return param1 + param2
end
AddFunctionExport("UsefulFunc", UsefulFunc)

Package Test2

test = ImportPackage("Test1")

print(test.UsefulFunc(2, 2))

See also

ImportPackage