GetResourceExportedFunctions: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: __NOTOC__ {{Server function}} Returns a table containing the names of the functions that a resource exports. ==Syntax== <syntaxhighlight lang="lua"> table getResourceExportedFunctions ( resource res ) </c...)
 
(Add missing OOP info)
 
(7 intermediate revisions by 5 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server function}}
{{Server client function}}
Returns a table containing the names of the functions that a resource exports.
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==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
table getResourceExportedFunctions ( resource res )
table getResourceExportedFunctions ( [ resource theResource = getThisResource( ) ] )
</syntaxhighlight>
</syntaxhighlight>
{{OOP||[[resource]]:getExportedFunctions|exportedFunctions}}


===Required 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==
Line 25: Line 26:
     end
     end
else
else
     outputConsole ( "Unable to find the scoreboard resource. ")
     outputConsole ( "Unable to find the scoreboard resource." )
end
end
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 13:45, 10 August 2021

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( ) ] )

OOP Syntax Help! I don't understand this!

Method: resource:getExportedFunctions(...)
Variable: .exportedFunctions


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