char *getconfig(const char *configfile)
{
    lua_State *L = lua_open(); 
    const char *cf;

    luaL_openlibs(L);

    if (luaL_loadfile(L, configfile) || lua_pcall(L, 0, 0, 0))
        bail(L, "can't run configuration file: %s", lua_tostring(L, -1));

    lua_getglobal(L, "SPOOLDIR");
    cf = lua_tostring(L, -1);
    lua_close(L);

    return (cf == NULL) ? NULL : strdup(cf);
}

