| 361 | */ |
| 362 | |
| 363 | LUALIB_API int luaL_checkoption (lua_State *L, int arg, const char *def, |
| 364 | const char *const lst[]) { |
| 365 | const char *name = (def) ? luaL_optstring(L, arg, def) : |
| 366 | luaL_checkstring(L, arg); |
| 367 | int i; |
| 368 | for (i=0; lst[i]; i++) |
| 369 | if (strcmp(lst[i], name) == 0) |
| 370 | return i; |
| 371 | return luaL_argerror(L, arg, |
| 372 | lua_pushfstring(L, "invalid option '%s'", name)); |
| 373 | } |
| 374 | |
| 375 | |
| 376 | /* |
no test coverage detected