AddFunctionExport: Difference between revisions

From Onset Developer Wiki
(Created page with "{{Info|Function|Server & Client|1.0}} {{FuncDescription|Exports a function that can later be imported from another package.}} {{FuncSyntax|AddFunctionExport(ExportName, Expo...")
(No difference)

Revision as of 20:56, 31 July 2019

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