GetModuleInfo: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
Line 18: Line 18:
Returns a [[string]] with the requested information about the module. If invalid names for parameters are passed, it will return ''false''.
Returns a [[string]] with the requested information about the module. If invalid names for parameters are passed, it will return ''false''.


==Example==  
==Example==
<syntaxhighlight lang="lua">--TODO</syntaxhighlight>
This example adds a command ''checkmodules'' with which you can view information about currently loaded modules.
<syntaxhighlight lang="lua">
function printModuleInfo ( thePlayer )
    local modules = getLoadedModules()
    if #modules == 0 then
        outputConsole ( "There are no modules loaded!", thePlayer )
    end
 
    for k, v in ipairs ( modules ) do
        local moduleName = getModuleInfo ( v, "Name" )
        local moduleVersion = getModuleInfo ( v, "Version" )
        local moduleAuthor = getModuleInfo ( v, "Author" )
        outputConsole ( moduleName .. "(" .. v .. ") v" .. moduleVersion .. ", author: " .. moduleAuthor, thePlayer )
    end
end
addCommandHandler ( "checkmodules", printModuleInfo )
</syntaxhighlight>


==See Also==
==See Also==
{{Module_functions}}
{{Module_functions}}

Revision as of 19:01, 18 May 2009

This function returns information about the specified module.

Syntax

string getModuleInfo ( string moduleName, string information )

Required Arguments

  • moduleName: A string containing the module you wish to get information of e.g. "hashing.dll"
  • information: A string containing the information you wish to retrieve. Currently supported parametres are
    • Version
    • Name
    • Author

Returns

Returns a string with the requested information about the module. If invalid names for parameters are passed, it will return false.

Example

This example adds a command checkmodules with which you can view information about currently loaded modules.

function printModuleInfo ( thePlayer )
    local modules = getLoadedModules()
    if #modules == 0 then
        outputConsole ( "There are no modules loaded!", thePlayer )
    end

    for k, v in ipairs ( modules ) do
        local moduleName = getModuleInfo ( v, "Name" )
        local moduleVersion = getModuleInfo ( v, "Version" )
        local moduleAuthor = getModuleInfo ( v, "Author" )
        outputConsole ( moduleName .. "(" .. v .. ") v" .. moduleVersion .. ", author: " .. moduleAuthor, thePlayer )
    end
end
addCommandHandler ( "checkmodules", printModuleInfo )

See Also