MCPcopy Create free account
hub / github.com/axmolengine/axmol / json_integer_option

Function json_integer_option

3rdparty/lua/lua-cjson/lua_cjson.c:231–247  ·  view source on GitHub ↗

Process integer options for configuration functions */

Source from the content-addressed store, hash-verified

229
230/* Process integer options for configuration functions */
231static int json_integer_option(lua_State *l, int optindex, int *setting,
232 int min, int max)
233{
234 char errmsg[64];
235 int value;
236
237 if (!lua_isnil(l, optindex)) {
238 value = luaL_checkinteger(l, optindex);
239 snprintf(errmsg, sizeof(errmsg), "expected integer between %d and %d", min, max);
240 luaL_argcheck(l, min <= value && value <= max, 1, errmsg);
241 *setting = value;
242 }
243
244 lua_pushinteger(l, *setting);
245
246 return 1;
247}
248
249/* Process enumerated arguments for a configuration function */
250static 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