GetResourceOrganizationalPath: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
(add oop variable name)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Server function}}
{{Server function}}
{{Needs_Example}}
__NOTOC__
__NOTOC__
This function returns the organizational file path (e.g. ''[admin]'') of a resource.
This function returns the organizational file path (e.g. ''[admin]'') of a resource.
Line 8: Line 7:
string getResourceOrganizationalPath ( resource theResource )
string getResourceOrganizationalPath ( resource theResource )
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP||[[resource]]:getOrganizationalPath }}
{{OOP||[[resource]]:getOrganizationalPath|organizationalPath }}


===Required Arguments===  
===Required Arguments===  
Line 14: Line 13:


===Returns===
===Returns===
Returns the organizational path of the [[resource]].
Returns the organizational folder name of the [[resource]]. It returns empty string if the resource is on root ''resources'' folder. It returns '''false''' if the resource could not be found.


==Example==  
==Example==
This example outputs the path of the current resource when it is started.
<syntaxhighlight lang="lua">
addEventHandler("onResourceStart", resourceRoot,
    function ()
        outputChatBox(getResourceName(resource) .. "'s path: " .. getResourceOrganizationalPath(resource))
    end)
</syntaxhighlight>


==See Also==
==See Also==
{{Resource_functions}}
{{Resource_functions}}

Latest revision as of 13:12, 10 August 2021

This function returns the organizational file path (e.g. [admin]) of a resource.

Syntax

string getResourceOrganizationalPath ( resource theResource )

OOP Syntax Help! I don't understand this!

Method: resource:getOrganizationalPath(...)
Variable: .organizationalPath


Required Arguments

  • theResource: the resource of which you want to know the organizational path

Returns

Returns the organizational folder name of the resource. It returns empty string if the resource is on root resources folder. It returns false if the resource could not be found.

Example

This example outputs the path of the current resource when it is started.

addEventHandler("onResourceStart", resourceRoot,
    function ()
        outputChatBox(getResourceName(resource) .. "'s path: " .. getResourceOrganizationalPath(resource))
    end)

See Also