typeof(variable);
| Argument | Description |
|---|---|
| variable | The variable to get the type of. |
Returns: String
This function returns the data type of any given variable as a string. The possible return values are listed in the table below:
| String | Description |
|---|---|
| number | The variable holds a real (floating point) number |
| string | The variable holds a string |
| array | The variable references an array |
| bool | The variable holds a boolean (true / false) |
| int32 | The variable holds a 32bit integer |
| int64 | The variable holds a 64 bit integer |
| ptr | The variable holds a pointer |
| undefined | The variable is undefined |
| null | The variable holds a null value (this should not be seen normally) |
| vec3 | The variable holds a 3 value vector |
| vec4 | The variable holds a 4 value vector |
| unknown | Value is unknown. This should never be seen and signifies that something has gone wrong at the most basic level like a memory overwrite |
data_str = typeof(global.ExtensionInput);
The above code gets the data type held by the given global variable and returns the string to an instance variable.