MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / json_integer_option

Function json_integer_option

deps/lua/src/lua_cjson.c:220–236  ·  view source on GitHub ↗

Process integer options for configuration functions */

Source from the content-addressed store, hash-verified

218
219/* Process integer options for configuration functions */
220static int json_integer_option(lua_State *l, int optindex, int *setting,
221 int min, int max)
222{
223 char errmsg[64];
224 int value;
225
226 if (!lua_isnil(l, optindex)) {
227 value = luaL_checkinteger(l, optindex);
228 snprintf(errmsg, sizeof(errmsg), "expected integer between %d and %d", min, max);
229 luaL_argcheck(l, min <= value && value <= max, 1, errmsg);
230 *setting = value;
231 }
232
233 lua_pushinteger(l, *setting);
234
235 return 1;
236}
237
238/* Process enumerated arguments for a configuration function */
239static int json_enum_option(lua_State *l, int optindex, int *setting,

Calls 2

luaL_checkintegerFunction · 0.85
lua_pushintegerFunction · 0.85

Tested by

no test coverage detected