Core Function isVarObj

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
(type)
(type)
 
(6 intermediate revisions by one user not shown)
Line 20: Line 20:
 
"class" Is it a CLASS (Any class)
 
"class" Is it a CLASS (Any class)
 
"file" Is it a File Handle
 
"file" Is it a File Handle
"binary" Is it a binary variable
 
 
"gui" Is it a GUI created from GUICreate()
 
"gui" Is it a GUI created from GUICreate()
 
"guiobject" Is it a GUI object such as one created from GUICreateButton()
 
"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
 
"mysql" Is it a connection to a MySQL server
 
"mysqldata" Is it a DataTable from MySQLFill() etc
 
"mysqldata" Is it a DataTable from MySQLFill() etc
Line 31: Line 28:
 
"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()
 
"error" Something has gone wrong and this object is totally invalid
 
"error" Something has gone wrong and this object is totally invalid
 
</pre>
 
</pre>
Line 38: Line 36:
 
=== Return Value ===
 
=== Return Value ===
  
Success: Returns 1.
+
Success: Returns true.
  
Failure: Returns 0.
+
Failure: Returns false.
  
 
=== Remarks ===
 
=== Remarks ===
Line 52: Line 50:
 
println( "Is it?: " . isVarObj($var1) );
 
println( "Is it?: " . isVarObj($var1) );
 
println( "Is it?: " . isVarObj($var1, "file") );
 
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) );
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
[[Category:Core Function]]
 
[[Category:Core Function]]

Latest revision as of 17:29, 20 June 2015

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) );
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox