SetResourceInfo: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
m (→See Also) |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 2: | Line 2: | ||
{{server function}} | {{server function}} | ||
This function sets the value of any attribute in a resource info tag. | This function sets the value of any attribute in a resource info tag. | ||
{{Note|This function requires the resource to have 'ModifyOtherObjects' [[ACL]] right.}} | |||
Note | |||
==Syntax== | ==Syntax== | ||
Line 9: | Line 8: | ||
bool setResourceInfo ( resource theResource, string attribute, string value ) | bool setResourceInfo ( resource theResource, string attribute, string value ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[resource]]:setInfo}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theResource:''' the resource we are setting info to. | *'''theResource:''' the resource we are setting info to. | ||
Line 26: | Line 25: | ||
outputChatBox( author .. " made this script." ) --tell the world his name | outputChatBox( author .. " made this script." ) --tell the world his name | ||
else --if it doesn't | else --if it doesn't | ||
setResourceInfo ( getThisResource(), "author", newAuthorName ) | |||
outputChatBox( "Author set to: "..newAuthorName ) --tell them that it was set | outputChatBox( "Author set to: "..newAuthorName ) --tell them that it was set | ||
end | end | ||
Line 33: | Line 32: | ||
==See Also== | ==See Also== | ||
{{Resource_functions}} | {{Resource_functions|server}} |
Latest revision as of 22:49, 6 September 2024
This function sets the value of any attribute in a resource info tag.
Syntax
bool setResourceInfo ( resource theResource, string attribute, string value )
OOP Syntax Help! I don't understand this!
- Method: resource:setInfo(...)
Required Arguments
- theResource: the resource we are setting info to.
- attribute: the name of the attribute that is to be set.
- value: the value of this attribute
Returns
Returns true if the info was successfully set, false otherwise
Example
This function sets the author of the current resource.
function outputAuthor(newAuthorName) 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 setResourceInfo ( getThisResource(), "author", newAuthorName ) outputChatBox( "Author set to: "..newAuthorName ) --tell them that it was set 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