GetResourceInfo: Difference between revisions
Jump to navigation
Jump to search
m (→Returns) |
m (→See Also) |
||
(5 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{server function}} | |||
This | This function retrieves the value of any attribute in a resource info tag. | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
getResourceInfo ( resource, string ) | string getResourceInfo ( resource theResource, string attribute ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[resource]]:getInfo}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theResource:''' the resource we are getting the info from. | |||
*''' | *'''attribute:''' the name of the attribute we want info about. | ||
*''' | |||
===Returns=== | ===Returns=== | ||
Returns a ''string'' with the attribute value if it exists, ''false'' otherwise. | |||
==Example== | ==Example== | ||
This function tells the server who's the author who made the currently running resource. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | function outputAuthor() | ||
author = getResourceInfo ( getThisResource(), "author" ) --Get the authors name | |||
-- | if author then --if it exists | ||
outputChatBox( author .. " made this script." ) --tell the world his name | |||
else --if it doesn't | |||
outputChatBox( "I've no idea who made this script." ) --apologize. | |||
end | |||
end | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Resource_functions|server}} | |||
{{ | |||
Latest revision as of 22:46, 6 September 2024
This function retrieves the value of any attribute in a resource info tag.
Syntax
string getResourceInfo ( resource theResource, string attribute )
OOP Syntax Help! I don't understand this!
- Method: resource:getInfo(...)
Required Arguments
- theResource: the resource we are getting the info from.
- attribute: the name of the attribute we want info about.
Returns
Returns a string with the attribute value if it exists, false otherwise.
Example
This function tells the server who's the author who made the currently running resource.
function outputAuthor() author = getResourceInfo ( getThisResource(), "author" ) --Get the authors name if author then --if it exists outputChatBox( author .. " made this script." ) --tell the world his name else --if it doesn't outputChatBox( "I've no idea who made this script." ) --apologize. end end
See Also
- addResourceConfig
- addResourceMap
- callRemote
- copyResource
- createResource
- deleteResource
- getResourceACLRequests
- getResourceInfo
- getResourceLastStartTime
- getResourceLoadFailureReason
- getResourceLoadTime
- getResourceMapRootElement
- getResourceOrganizationalPath
- getResources
- isResourceArchived
- isResourceProtected
- refreshResources
- removeResourceFile
- renameResource
- restartResource
- setResourceInfo
- startResource
- stopResource
- updateResourceACLRequest
- Shared
- abortRemoteRequest
- call
- fetchRemote
- getResourceConfig
- getResourceDynamicElementRoot
- getResourceExportedFunctions
- getResourceFromName
- getResourceName
- getResourceRootElement
- getResourceState
- getThisResource
- getRemoteRequests
- getRemoteRequestInfo