getAllElementData | Multi Theft Auto: Wiki Skip to content

getAllElementData

Client-side
Server-side
Shared

Updated in 1.6.0 r21695

Returns a table of all element data of an element.

OOP Syntax Help! I don't understand this!

Syntax

table|false getAllElementData ( ​element theElement )
Required arguments
  • theElement: The element you want to get the element data of.

Returns

If successful, returns a table with as keys the names of the element data and as values the corresponding element data values. Returns false in case of failure.

  • table|false: data

Code Examples

server

This example script creates a new console command that displays all element data that is currently set on the player who enters the command.

function getMyData(thePlayer, command)
local data = getAllElementData(thePlayer) -- get all the element data of the player who entered the command
for k, v in pairs(data) do -- loop through the table that was returned
outputConsole(k .. ": " .. tostring(v)) -- print the name (k) and value (v) of each element data, we need to make the value a string, since it can be of any data type
end
end
addCommandHandler("elemdata", getMyData)

Changelog

  • 1.6.0 r21695

    Added also as a client-side function.

  • See Also

    Element Functions