GetResourceInfo: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
Line 16: Line 16:


==Example==
==Example==
This function tells the server who's the author who made the currently running resource.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
function outputAuthor()
blabhalbalhb --abababa
    author = getResourceInfo ( getThisResource(), "author" )    --Get the authors name
--This line does this...
    if author then    --if it exists
mooo
        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}}
{{Resource_functions}}
[[Category:Incomplete]]

Revision as of 09:37, 30 July 2007

Dialog-information.png This article needs checking.

Reason(s): may return a string, bool or nil (?) --jbeta

This function retrieves the value of any attribute in a resource info tag.

Syntax

string getResourceInfo ( resource theResource, string attribute ) 

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