Core Function isVarObj
From Sputnik Wiki
(Difference between revisions)
(→Return Value) |
(→type) |
||
Line 31: | Line 31: | ||
"server" Is it a server created by using SSListen() | "server" Is it a server created by using SSListen() | ||
"client" Is it a client created by SSConnect() | "client" Is it a client created by SSConnect() | ||
+ | "func" Is it a function created by typing the function on the = or using MKFunc() | ||
+ | "stream" Is it a binary stream created using StreamCreate() | ||
"error" Something has gone wrong and this object is totally invalid | "error" Something has gone wrong and this object is totally invalid | ||
</pre> | </pre> |
Revision as of 14:35, 4 September 2013
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 "binary" Is it a binary variable "gui" Is it a GUI created from GUICreate() "guiobject" Is it a GUI object such as one created from GUICreateButton() "assembly" Is it a loaded .NET assembly DLL etc "method" Is it a method loaded from a .NET assembly "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() "stream" Is it a binary stream created using StreamCreate() "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) );