aboutsummaryrefslogtreecommitdiff
path: root/lauxlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lauxlib.c')
-rw-r--r--lauxlib.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/lauxlib.c b/lauxlib.c
index 0c64f9e5..b8205191 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.c,v 1.132 2005/05/16 21:19:00 roberto Exp roberto $ 2** $Id: lauxlib.c,v 1.133 2005/05/17 19:49:15 roberto Exp roberto $
3** Auxiliary functions for building Lua libraries 3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -95,12 +95,15 @@ LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) {
95/* }====================================================== */ 95/* }====================================================== */
96 96
97 97
98LUALIB_API int luaL_findstring (const char *name, const char *const list[]) { 98LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def,
99 const char *const lst[]) {
100 const char *name = (def) ? luaL_optstring(L, narg, def) :
101 luaL_checkstring(L, narg);
99 int i; 102 int i;
100 for (i=0; list[i]; i++) 103 for (i=0; lst[i]; i++)
101 if (strcmp(list[i], name) == 0) 104 if (strcmp(lst[i], name) == 0)
102 return i; 105 return i;
103 return -1; /* name not found */ 106 return luaL_error(L, "invalid option " LUA_QS, name);
104} 107}
105 108
106 109