summaryrefslogtreecommitdiff
path: root/loslib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-05-25 10:21:26 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-05-25 10:21:26 -0300
commite8a7ecb982effdfc1148098b288c6ac7130f756e (patch)
tree5229dadc11873122ff55042e1d08f545d25bb839 /loslib.c
parent38da9d568a4702a6f9405882db56c2a2aa3189c1 (diff)
downloadlua-github-e8a7ecb982effdfc1148098b288c6ac7130f756e.tar.gz
luaL_findstring -> luaL_checkoption
Diffstat (limited to 'loslib.c')
-rw-r--r--loslib.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/loslib.c b/loslib.c
index 0d3b7047..48dc9179 100644
--- a/loslib.c
+++ b/loslib.c
@@ -1,5 +1,5 @@
/*
-** $Id: loslib.c,v 1.8 2005/05/16 21:19:00 roberto Exp roberto $
+** $Id: loslib.c,v 1.9 2005/05/17 19:49:15 roberto Exp roberto $
** Standard Operating System library
** See Copyright Notice in lua.h
*/
@@ -197,9 +197,8 @@ static int io_setloc (lua_State *L) {
static const char *const catnames[] = {"all", "collate", "ctype", "monetary",
"numeric", "time", NULL};
const char *l = lua_tostring(L, 1);
- int op = luaL_findstring(luaL_optstring(L, 2, "all"), catnames);
+ int op = luaL_checkoption(L, 2, "all", catnames);
luaL_argcheck(L, l || lua_isnoneornil(L, 1), 1, "string expected");
- luaL_argcheck(L, op != -1, 2, "invalid option");
lua_pushstring(L, setlocale(cat[op], l));
return 1;
}