public static Object getOptArg(LuaCallFrame callFrame, int n, String type) {
        // Outside of stack
        if (n - 1 >= callFrame.getTop()) {
            return null;
        }

        Object o = callFrame.get(n-1);
        if (o == null) {
            return null;
        }
        // type coercion
        if (type == TYPE_STRING) {
            return rawTostring(o);
        } else if (type == TYPE_NUMBER) {
            return rawTonumber(o);
        }
        // no type checking, this is optional after all
        return o;
    }
@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