diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-06-18 14:04:28 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-06-18 14:04:28 -0300 |
commit | 955a811aa1ab50cc4165d88cdf5a259b7b77582a (patch) | |
tree | 856913f7eb752cb162e3be3a64249e6fa1be0d03 | |
parent | c9902be294f5c2dca8a67a67fd324f91e4352c0a (diff) | |
download | lua-955a811aa1ab50cc4165d88cdf5a259b7b77582a.tar.gz lua-955a811aa1ab50cc4165d88cdf5a259b7b77582a.tar.bz2 lua-955a811aa1ab50cc4165d88cdf5a259b7b77582a.zip |
category for "setlocale" is given by name
-rw-r--r-- | liolib.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: liolib.c,v 1.19 1998/06/02 21:20:54 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 1.20 1998/06/05 22:17:44 roberto Exp roberto $ |
3 | ** Standard I/O (and system) library | 3 | ** Standard I/O (and system) library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -326,8 +326,10 @@ static void setloc (void) | |||
326 | { | 326 | { |
327 | static int cat[] = {LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, | 327 | static int cat[] = {LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, |
328 | LC_TIME}; | 328 | LC_TIME}; |
329 | int op = (int)luaL_opt_number(2, 0); | 329 | static char *catnames[] = {"all", "collate", "ctype", "monetary", |
330 | luaL_arg_check(0 <= op && op <= 5, 2, "invalid option"); | 330 | "numeric", "time", NULL}; |
331 | int op = luaL_findstring(luaL_opt_string(2, "all"), catnames); | ||
332 | luaL_arg_check(op != -1, 2, "invalid option"); | ||
331 | lua_pushstring(setlocale(cat[op], luaL_check_string(1))); | 333 | lua_pushstring(setlocale(cat[op], luaL_check_string(1))); |
332 | } | 334 | } |
333 | 335 | ||