| 346 | */ |
| 347 | |
| 348 | LUALIB_API int luaL_checkoption (lua_State *L, int arg, const char *def, |
| 349 | const char *const lst[]) { |
| 350 | const char *name = (def) ? luaL_optstring(L, arg, def) : |
| 351 | luaL_checkstring(L, arg); |
| 352 | int i; |
| 353 | for (i=0; lst[i]; i++) |
| 354 | if (strcmp(lst[i], name) == 0) |
| 355 | return i; |
| 356 | return luaL_argerror(L, arg, |
| 357 | lua_pushfstring(L, "invalid option '%s'", name)); |
| 358 | } |
| 359 | |
| 360 | |
| 361 | /* |
no test coverage detected