IsElement

From Multi Theft Auto: Wiki
Revision as of 10:33, 4 March 2007 by Jbeta (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This function checks if a value is an element or not.

Syntax

bool isElement ( var )

Required Arguments

  • var: A value that may or may not be an element.

Returns

Returns true if the passed value is an element, false otherwise.

Example

This example checks if the

--we create a variable
local var
--we randomise its value
if math.random(0,1) == 1 then var = getRootElement()
else var = "string"
end
--and then we can check if it's an element or not
if isElement(var) then outputChatBox("math.random generated number 1")
else then outputChatBox("math.random generated number 0")
end

See Also