@@ -46,25 +46,19 @@ create_expire_output(lua_State *lua_state, std::string const &default_schema,
4646 }
4747
4848 // required "maxzoom" field
49- auto value = luaX_get_table_optional_uint32 (
50- lua_state, " maxzoom" , -1 , " The 'maxzoom' field in a expire output" );
51- if (value >= 1 && value <= 20 ) {
52- new_expire_output.set_minzoom (value);
53- new_expire_output.set_maxzoom (value);
54- } else {
55- throw std::runtime_error{
56- " Value of 'maxzoom' field must be between 1 and 20." };
57- }
49+ auto const maxzoom = luaX_get_table_optional_uint32 (
50+ lua_state, " maxzoom" , -1 , " The 'maxzoom' field in a expire output" , 1 ,
51+ 20 , " 1 and 20" );
52+ new_expire_output.set_minzoom (maxzoom);
53+ new_expire_output.set_maxzoom (maxzoom);
5854 lua_pop (lua_state, 1 ); // "maxzoom"
5955
6056 // optional "minzoom" field
61- value = luaX_get_table_optional_uint32 (
62- lua_state, " minzoom" , -1 , " The 'minzoom' field in a expire output" );
63- if (value >= 1 && value <= new_expire_output.maxzoom ()) {
64- new_expire_output.set_minzoom (value);
65- } else if (value != 0 ) {
66- throw std::runtime_error{
67- " Value of 'minzoom' field must be between 1 and 'maxzoom'." };
57+ auto const minzoom = luaX_get_table_optional_uint32 (
58+ lua_state, " minzoom" , -1 , " The 'minzoom' field in a expire output" , 1 ,
59+ maxzoom, " 1 and 'maxzoom'" );
60+ if (minzoom > 0 ) {
61+ new_expire_output.set_minzoom (minzoom);
6862 }
6963 lua_pop (lua_state, 1 ); // "minzoom"
7064
0 commit comments