| 97 | |
| 98 | |
| 99 | LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def, |
| 100 | const char *const lst[]) { |
| 101 | const char *name = (def) ? luaL_optstring(L, narg, def) : |
| 102 | luaL_checkstring(L, narg); |
| 103 | int i; |
| 104 | for (i=0; lst[i]; i++) |
| 105 | if (strcmp(lst[i], name) == 0) |
| 106 | return i; |
| 107 | return luaL_argerror(L, narg, |
| 108 | lua_pushfstring(L, "invalid option " LUA_QS, name)); |
| 109 | } |
| 110 | |
| 111 | |
| 112 | LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) { |
no test coverage detected