Core Function isVarObj
From Sputnik Wiki
isVarObj( $variable, <type> )
Contents |
Description
Check if a variable is an object type (This includes classes, file handles etc).
Parameters
variable
The variable to check.
type
Optoinal; The type to check against valid types are:
[TYPE] [DETAILS] "class" Is it a CLASS (Any class) "file" Is it a File Handle "gui" Is it a GUI created from GUICreate() "guiobject" Is it a GUI object such as one created from GUICreateButton() "mysql" Is it a connection to a MySQL server "mysqldata" Is it a DataTable from MySQLFill() etc "dllstruct" Is it a C/C++ structure for use in in DLLCalls "object" Is it an unknown object such as one taken by GUIGetProp without a valid conversion "server" Is it a server created by using SSListen() "client" Is it a client created by SSConnect() "func" Is it a function created by typing the function on the = or using MKFunc() "error" Something has gone wrong and this object is totally invalid
Default just checks if it IS an object type or not.
Return Value
Success: Returns true.
Failure: Returns false.
Remarks
None.
Example
$var1 = "check me"; println( "Is it?: " . isVarObj($var1) ); println( "Is it?: " . isVarObj($var1, "file") ); // You can also check if its an object type using "~~" and "is" operators println( "Is it?: " . ($var1 ~~ Class) ); println( "Is it?: " . ($var1 ~~ DLLStruct) ); println( "Is it?: " . ($var1 ~~ Server) ); println( "Is it?: " . ($var1 ~~ Client) ); println( "Is it?: " . ($var1 is Class) ); println( "Is it?: " . ($var1 is DLLStruct) ); println( "Is it?: " . ($var1 is Server) ); println( "Is it?: " . ($var1 is Client) );