Process integer options for configuration functions */
| 269 | |
| 270 | /* Process integer options for configuration functions */ |
| 271 | static int json_integer_option(lua_State *l, int optindex, int *setting, |
| 272 | int min, int max) |
| 273 | { |
| 274 | char errmsg[64]; |
| 275 | int value; |
| 276 | |
| 277 | if (!lua_isnil(l, optindex)) { |
| 278 | value = luaL_checkinteger(l, optindex); |
| 279 | snprintf(errmsg, sizeof(errmsg), "expected integer between %d and %d", min, max); |
| 280 | luaL_argcheck(l, min <= value && value <= max, 1, errmsg); |
| 281 | *setting = value; |
| 282 | } |
| 283 | |
| 284 | lua_pushinteger(l, *setting); |
| 285 | |
| 286 | return 1; |
| 287 | } |
| 288 | |
| 289 | /* Process enumerated arguments for a configuration function */ |
| 290 | static int json_enum_option(lua_State *l, int optindex, int *setting, |
no test coverage detected