public static String type(Object o) {
        if (o == null) {
            return TYPE_NIL;
        }
        if (o instanceof String) {
            return TYPE_STRING;
        }
        if (o instanceof Double) {
            return TYPE_NUMBER;
        }
        if (o instanceof Boolean) {
            return TYPE_BOOLEAN;
        }
        if (o instanceof JavaFunction || o instanceof LuaClosure) {
            return TYPE_FUNCTION;
        }
        if (o instanceof LuaTable) {
            return TYPE_TABLE;
        }
        if (o instanceof LuaThread) {
            return TYPE_THREAD;
        }
        return TYPE_USERDATA;
    }
@param callFrame
@param n
@param type must be "string" or "number" or one of the other built in types. Note that this parameter must be interned!
It's not valid to call it with new String("number").  Use null if you don't care which type or expect
more than one type for this argument.
@param function name of the function that calls this. Only for pretty exceptions.
@return variable with index n on the stack, returned as type "type".
main/src/main/java/cgeo/geocaching/wherigo/kahlua/stdlib/BaseLib.java