AddFunctionExport

From Onset Developer Wiki
Revision as of 20:56, 31 July 2019 by BlueMountains (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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