GetAllAccountData: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 28: Line 28:
addCommandHandler( "getall", printAllData ) -- add a command handler for command 'getall'
addCommandHandler( "getall", printAllData ) -- add a command handler for command 'getall'
</syntaxhighlight>
</syntaxhighlight>
==Requirements==
{{Requirements|1.3.0-9.03804|n/a|}}


==See Also==
==See Also==
{{Account functions}}
{{Account functions}}

Revision as of 10:29, 17 May 2012

This function returns a table containing all the user data for the account provided

Syntax

table getAllAccountData ( account theAccount )

Returns

A table containing all the user data. This table might be empty.

Example

function printAllData ( thePlayer )
    local playerAccount = getPlayerAccount( thePlayer ) -- get his account
    if ( playerAccount ) then -- if we got the account then
        local data = getAllAccountData( playerAccount ) -- get data
        count = 0
        for _ in pairs(data) do count = count + 1 end -- get the count
        outputChatBox ( "table holds " .. count .. " entries" ) -- output number of rows
        if ( data ) then
            for k,v in pairs ( data ) do
                outputChatBox(k..": "..v) -- print the key and value of each entry of data
            end
        end
    end
end
addCommandHandler( "getall", printAllData ) -- add a command handler for command 'getall'

Requirements

This template will be deleted.

See Also