From a thread of mine a while back, I stumbled rather inadvertantly on what i think is a way to do this. The basic principle is, in a
function, if you perform an operation
only designed for one data type on
another data type within the bounds of a call statement, the statement crashes without throwing an error/warning and fails to return anything. I/we used this to make a checking function to see if an array-storing variable had been initialised, but it could be converted to do this.
Example code:
_unknown = _this select 0;
_isArray = _unknown call {(count _this == count _this)};
if (_isArray) then {... array related stuff}; // _isArray either equals true or scalar bool array...
_isObject = _unknown call {getPos _this; true};
if (_isObject) then {... object related stuff};
_isNumber = _unknown call {(_this*3 == _this*3)};
if (_isNumber) then {... number related stuff};
I havent tested the object or the number code, but I know that the array code works, and based on the same principle the other 2 should too. Give it a go, anyway
I like the idea of operator overloading, as well as having type-safe functions.
EDIT: Paddy, the typeOf command only works on variables of type Object, that is, men, vehicles, bullets, houses and so on. It will complain with an error message at the top of flashpoint if you attempt to use it with any other type, like a number. Also, count only works on arrays, where it returns the number of elements. Again, it will cause errors if you try use it on for example a String.