diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-05-25 10:21:26 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-05-25 10:21:26 -0300 |
| commit | e8a7ecb982effdfc1148098b288c6ac7130f756e (patch) | |
| tree | 5229dadc11873122ff55042e1d08f545d25bb839 /loslib.c | |
| parent | 38da9d568a4702a6f9405882db56c2a2aa3189c1 (diff) | |
| download | lua-e8a7ecb982effdfc1148098b288c6ac7130f756e.tar.gz lua-e8a7ecb982effdfc1148098b288c6ac7130f756e.tar.bz2 lua-e8a7ecb982effdfc1148098b288c6ac7130f756e.zip | |
luaL_findstring -> luaL_checkoption
Diffstat (limited to 'loslib.c')
| -rw-r--r-- | loslib.c | 5 |
1 files changed, 2 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: loslib.c,v 1.8 2005/05/16 21:19:00 roberto Exp roberto $ | 2 | ** $Id: loslib.c,v 1.9 2005/05/17 19:49:15 roberto Exp roberto $ |
| 3 | ** Standard Operating System library | 3 | ** Standard Operating System library |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -197,9 +197,8 @@ static int io_setloc (lua_State *L) { | |||
| 197 | static const char *const catnames[] = {"all", "collate", "ctype", "monetary", | 197 | static const char *const catnames[] = {"all", "collate", "ctype", "monetary", |
| 198 | "numeric", "time", NULL}; | 198 | "numeric", "time", NULL}; |
| 199 | const char *l = lua_tostring(L, 1); | 199 | const char *l = lua_tostring(L, 1); |
| 200 | int op = luaL_findstring(luaL_optstring(L, 2, "all"), catnames); | 200 | int op = luaL_checkoption(L, 2, "all", catnames); |
| 201 | luaL_argcheck(L, l || lua_isnoneornil(L, 1), 1, "string expected"); | 201 | luaL_argcheck(L, l || lua_isnoneornil(L, 1), 1, "string expected"); |
| 202 | luaL_argcheck(L, op != -1, 2, "invalid option"); | ||
| 203 | lua_pushstring(L, setlocale(cat[op], l)); | 202 | lua_pushstring(L, setlocale(cat[op], l)); |
| 204 | return 1; | 203 | return 1; |
| 205 | } | 204 | } |
