| 318 | */ |
| 319 | |
| 320 | LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def, |
| 321 | const char *const lst[]) { |
| 322 | const char *name = (def) ? luaL_optstring(L, narg, def) : |
| 323 | luaL_checkstring(L, narg); |
| 324 | int i; |
| 325 | for (i=0; lst[i]; i++) |
| 326 | if (strcmp(lst[i], name) == 0) |
| 327 | return i; |
| 328 | return luaL_argerror(L, narg, |
| 329 | lua_pushfstring(L, "invalid option " LUA_QS, name)); |
| 330 | } |
| 331 | |
| 332 | |
| 333 | LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *msg) { |
no test coverage detected