Why function used in function do not work? [closed]

Outer function for find max in array. Array contain some objects and f() used for get parameter from object.

function table_max(array, f)
{
    var rmax = -2147483648;

    for(var i = array.length - 1; i >= 0; i--)
    {
        if(f(array[i]) > rmax) rmax = f(array[i]);
    }
    return rmax;
}

This function used for create table:

function(o, p)
{
    return table_max(o.stats_g, function(o, p){ return p.stat[7]; });
}

But i get error: p is undefined.

But this work:

function(o, p)
{
    return p.stat[7];
}