GetResourceExportedFunctions: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 5: Line 5:
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
table|false getResourceExportedFunctions ( [ resource res ] )
table getResourceExportedFunctions ( [ resource theResource = getThisResource( ) ] )
</syntaxhighlight>
</syntaxhighlight>


===Optional Arguments===
===Optional Arguments===
*'''res:''' the resource of which you want to know the exported functions.
*'''theResource:''' the [[resource]] of which you want to know the [[call|exported functions]].


===Returns===
===Returns===
Returns a table of function names if successful, ''false'' otherwise.
Returns a [[table]] of function names if successful, ''false'' otherwise.


==Example==
==Example==

Revision as of 12:06, 12 May 2018

Returns a table containing the names of the functions that a resource exports. It will return the exports of the current resource if there is no argument passed in.

Syntax

table getResourceExportedFunctions ( [ resource theResource = getThisResource( ) ] )

Optional Arguments

Returns

Returns a table of function names if successful, false otherwise.

Example

This simple example will output the names of the functions that the "scoreboard" resource exports.

local res = getResourceFromName ( "scoreboard" )
if res then
    local functionNames = getResourceExportedFunctions ( res )
    outputConsole ( "The scoreboard resource exports " .. #functionNames .. " functions:" )
    for i, name in ipairs ( functionNames ) do
        outputConsole ( name )
    end
else
    outputConsole ( "Unable to find the scoreboard resource." )
end

See Also