static int readIntegralArea(lua_State* luaSt, IntegralArea* iaOut, int table)
{
    static IntegralArea ia;
    static real nuStepsf, muStepsf, rStepsf;
    static const MWNamedArg iaArgTable[] =
        {
            { "nu_min",   LUA_TNUMBER, NULL, TRUE, &ia.nu_min },
            { "nu_max",   LUA_TNUMBER, NULL, TRUE, &ia.nu_max },
            { "nu_steps", LUA_TNUMBER, NULL, TRUE, &nuStepsf  },

            { "mu_min",   LUA_TNUMBER, NULL, TRUE, &ia.mu_min },
            { "mu_max",   LUA_TNUMBER, NULL, TRUE, &ia.mu_max },
            { "mu_steps", LUA_TNUMBER, NULL, TRUE, &muStepsf  },

            { "r_min",    LUA_TNUMBER, NULL, TRUE, &ia.r_min  },
            { "r_max",    LUA_TNUMBER, NULL, TRUE, &ia.r_max  },
            { "r_steps",  LUA_TNUMBER, NULL, TRUE, &rStepsf   },
            END_MW_NAMED_ARG
        };

    handleNamedArgumentTable(luaSt, iaArgTable, table);

    ia.nu_steps = (unsigned int) nuStepsf;
    ia.mu_steps = (unsigned int) muStepsf;
    ia.r_steps = (unsigned int) rStepsf;
    calcIntegralStepSizes(&ia);

    *iaOut = ia;

    return 0;
}
static int readIntegralArea(lua_State* luaSt, IntegralArea* iaOut, int table)
{
    uint64_t r, mu, nu;
    static IntegralArea ia;
    static real nuStepsf, muStepsf, rStepsf;
    static const MWNamedArg iaArgTable[] =
        {
            { "nu_min",   LUA_TNUMBER, NULL, TRUE, &ia.nu_min },
            { "nu_max",   LUA_TNUMBER, NULL, TRUE, &ia.nu_max },
            { "nu_steps", LUA_TNUMBER, NULL, TRUE, &nuStepsf  },

            { "mu_min",   LUA_TNUMBER, NULL, TRUE, &ia.mu_min },
            { "mu_max",   LUA_TNUMBER, NULL, TRUE, &ia.mu_max },
            { "mu_steps", LUA_TNUMBER, NULL, TRUE, &muStepsf  },

            { "r_min",    LUA_TNUMBER, NULL, TRUE, &ia.r_min  },
            { "r_max",    LUA_TNUMBER, NULL, TRUE, &ia.r_max  },
            { "r_steps",  LUA_TNUMBER, NULL, TRUE, &rStepsf   },
            END_MW_NAMED_ARG
        };

    handleNamedArgumentTable(luaSt, iaArgTable, table);

    ia.nu_steps = (unsigned int) nuStepsf;
    ia.mu_steps = (unsigned int) muStepsf;
    ia.r_steps = (unsigned int) rStepsf;

    r = (uint64_t) ia.r_steps;
    mu = (uint64_t) ia.mu_steps;
    nu = (uint64_t) ia.nu_steps;

    if (nu == 0 || mu == 0 || r == 0)
    {
        mw_printf("Integral size { %u, %u, %u } cannot be 0\n", nu, mu, r);
        return 1;
    }

    if ((r > UINT64_MAX / mu) || ((r * mu) > UINT64_MAX / nu))
    {
        mw_printf("Integral size { %u, %u, %u } will overflow progress calculation\n",
                  ia.nu_steps, ia.mu_steps, ia.r_steps);
        return 1;
    }

    calcIntegralStepSizes(&ia);

    *iaOut = ia;

    return 0;
}