IsObjectValid(handle)
Description
Section titled âDescriptionâThe IsObjectValid function returns a boolean true or nil depending on whether the supplied argument is a valid object.
Arguments
Section titled âArgumentsâ- Handle:
The argument should be the handle to a possible object.
- Boolean or nil:
The returned value is a boolean True if the handle is a valid object or it returns nil if it is not a valid object.
Example
Section titled âExampleâThis example below examines if âRoot()â is a valid object and prints meaningful feedback:
| Copy CodeLua |
| ``` |
| return function() |
--Create a variable with the possible objectlocal myObject = Root()--Check if it is an objectlocal myReturn = IsObjectValid(myObject)--Print the resultif myReturn == nil then ErrPrintf("It is not a valid object")else Printf("It is an object")endend