MCPcopy Create free account
hub / github.com/defold/defold / json_integer_option

Function json_integer_option

engine/script/src/luacjson/lua_cjson.c:271–287  ·  view source on GitHub ↗

Process integer options for configuration functions */

Source from the content-addressed store, hash-verified

269
270/* Process integer options for configuration functions */
271static 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 */
290static 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