aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1998-06-18 14:04:28 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1998-06-18 14:04:28 -0300
commit955a811aa1ab50cc4165d88cdf5a259b7b77582a (patch)
tree856913f7eb752cb162e3be3a64249e6fa1be0d03
parentc9902be294f5c2dca8a67a67fd324f91e4352c0a (diff)
downloadlua-955a811aa1ab50cc4165d88cdf5a259b7b77582a.tar.gz
lua-955a811aa1ab50cc4165d88cdf5a259b7b77582a.tar.bz2
lua-955a811aa1ab50cc4165d88cdf5a259b7b77582a.zip
category for "setlocale" is given by name
-rw-r--r--liolib.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/liolib.c b/liolib.c
index db374b44..d252931c 100644
--- a/liolib.c
+++ b/liolib.c
@@ -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