aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-06-05 14:24:04 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-06-05 14:24:04 -0300
commit5b8ee9fa8d9bc3d3ad41a1acd547b79bc3b669a7 (patch)
treee9d62d00cd762b64e30ce2297319f91064d54d7e
parent2cd6161060f3e9149e7a61a126bec76cd4f1b333 (diff)
downloadlua-5b8ee9fa8d9bc3d3ad41a1acd547b79bc3b669a7.tar.gz
lua-5b8ee9fa8d9bc3d3ad41a1acd547b79bc3b669a7.tar.bz2
lua-5b8ee9fa8d9bc3d3ad41a1acd547b79bc3b669a7.zip
new names for standard libraries
-rw-r--r--lbaselib.c4
-rw-r--r--ldblib.c4
-rw-r--r--liolib.c8
-rw-r--r--lmathlib.c4
-rw-r--r--lstrlib.c4
-rw-r--r--ltablib.c4
-rw-r--r--lualib.h14
7 files changed, 27 insertions, 15 deletions
diff --git a/lbaselib.c b/lbaselib.c
index 847b91ef..e146318d 100644
--- a/lbaselib.c
+++ b/lbaselib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lbaselib.c,v 1.76 2002/06/03 20:11:41 roberto Exp roberto $ 2** $Id: lbaselib.c,v 1.77 2002/06/05 16:59:21 roberto Exp roberto $
3** Basic library 3** Basic library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -459,7 +459,7 @@ static const luaL_reg co_funcs[] = {
459 459
460 460
461static void co_open (lua_State *L) { 461static void co_open (lua_State *L) {
462 luaL_opennamedlib(L, "co", co_funcs, 0); 462 luaL_opennamedlib(L, LUA_COLIBNAME, co_funcs, 0);
463 /* create metatable for coroutines */ 463 /* create metatable for coroutines */
464 lua_pushliteral(L, "Coroutine"); 464 lua_pushliteral(L, "Coroutine");
465 lua_newtable(L); 465 lua_newtable(L);
diff --git a/ldblib.c b/ldblib.c
index 04f03aed..329cb23d 100644
--- a/ldblib.c
+++ b/ldblib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldblib.c,v 1.53 2002/05/16 18:39:46 roberto Exp roberto $ 2** $Id: ldblib.c,v 1.54 2002/06/03 17:47:18 roberto Exp roberto $
3** Interface from Lua to its debug API 3** Interface from Lua to its debug API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -246,7 +246,7 @@ static const luaL_reg dblib[] = {
246 246
247 247
248LUALIB_API int lua_dblibopen (lua_State *L) { 248LUALIB_API int lua_dblibopen (lua_State *L) {
249 luaL_opennamedlib(L, "dbg", dblib, 0); 249 luaL_opennamedlib(L, LUA_DBLIBNAME, dblib, 0);
250 lua_register(L, "_ERRORMESSAGE", errorfb); 250 lua_register(L, "_ERRORMESSAGE", errorfb);
251 return 0; 251 return 0;
252} 252}
diff --git a/liolib.c b/liolib.c
index 5ed8fae2..e43d2261 100644
--- a/liolib.c
+++ b/liolib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: liolib.c,v 2.5 2002/05/06 19:05:10 roberto Exp roberto $ 2** $Id: liolib.c,v 2.6 2002/06/05 16:59:37 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*/
@@ -594,12 +594,12 @@ static const luaL_reg syslib[] = {
594 594
595LUALIB_API int lua_iolibopen (lua_State *L) { 595LUALIB_API int lua_iolibopen (lua_State *L) {
596 createmeta(L); 596 createmeta(L);
597 luaL_opennamedlib(L, "os", syslib, 0); 597 luaL_opennamedlib(L, LUA_OSLIBNAME, syslib, 0);
598 lua_pushliteral(L, FILEHANDLE); /* S: FH */ 598 lua_pushliteral(L, FILEHANDLE); /* S: FH */
599 lua_rawget(L, LUA_REGISTRYINDEX); /* S: mt */ 599 lua_rawget(L, LUA_REGISTRYINDEX); /* S: mt */
600 lua_pushvalue(L, -1); /* S: mt mt */ 600 lua_pushvalue(L, -1); /* S: mt mt */
601 luaL_opennamedlib(L, "io", iolib, 1); /* S: mt */ 601 luaL_opennamedlib(L, LUA_IOLIBNAME, iolib, 1); /* S: mt */
602 lua_pushliteral(L, "io"); /* S: `io' mt */ 602 lua_pushliteral(L, LUA_IOLIBNAME); /* S: `io' mt */
603 lua_gettable(L, LUA_GLOBALSINDEX); /* S: io mt */ 603 lua_gettable(L, LUA_GLOBALSINDEX); /* S: io mt */
604 /* put predefined file handles into `io' table */ 604 /* put predefined file handles into `io' table */
605 registerfile(L, stdin, "stdin", IO_INPUT); 605 registerfile(L, stdin, "stdin", IO_INPUT);
diff --git a/lmathlib.c b/lmathlib.c
index 4890f6f9..c14c5d72 100644
--- a/lmathlib.c
+++ b/lmathlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lmathlib.c,v 1.44 2002/05/02 17:12:27 roberto Exp roberto $ 2** $Id: lmathlib.c,v 1.45 2002/05/06 19:05:10 roberto Exp roberto $
3** Standard mathematical library 3** Standard mathematical library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -231,7 +231,7 @@ static const luaL_reg mathlib[] = {
231** Open math library 231** Open math library
232*/ 232*/
233LUALIB_API int lua_mathlibopen (lua_State *L) { 233LUALIB_API int lua_mathlibopen (lua_State *L) {
234 lua_pushliteral(L, "math"); 234 lua_pushliteral(L, LUA_MATHLIBNAME);
235 lua_newtable(L); 235 lua_newtable(L);
236 luaL_openlib(L, mathlib, 0); 236 luaL_openlib(L, mathlib, 0);
237 lua_pushliteral(L, "pi"); 237 lua_pushliteral(L, "pi");
diff --git a/lstrlib.c b/lstrlib.c
index 8a3cd686..27d991cf 100644
--- a/lstrlib.c
+++ b/lstrlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstrlib.c,v 1.81 2002/05/02 17:12:27 roberto Exp roberto $ 2** $Id: lstrlib.c,v 1.82 2002/05/06 19:05:10 roberto Exp roberto $
3** Standard library for string operations and pattern-matching 3** Standard library for string operations and pattern-matching
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -726,7 +726,7 @@ static const luaL_reg strlib[] = {
726** Open string library 726** Open string library
727*/ 727*/
728LUALIB_API int lua_strlibopen (lua_State *L) { 728LUALIB_API int lua_strlibopen (lua_State *L) {
729 luaL_opennamedlib(L, "str", strlib, 0); 729 luaL_opennamedlib(L, LUA_STRLIBNAME, strlib, 0);
730 return 0; 730 return 0;
731} 731}
732 732
diff --git a/ltablib.c b/ltablib.c
index 070569de..4637a00b 100644
--- a/ltablib.c
+++ b/ltablib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltablib.c,v 1.3 2002/05/02 17:12:27 roberto Exp roberto $ 2** $Id: ltablib.c,v 1.4 2002/06/05 16:59:21 roberto Exp roberto $
3** Library for Table Manipulation 3** Library for Table Manipulation
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -226,7 +226,7 @@ static const luaL_reg tab_funcs[] = {
226 226
227 227
228LUALIB_API int lua_tablibopen (lua_State *L) { 228LUALIB_API int lua_tablibopen (lua_State *L) {
229 luaL_opennamedlib(L, "tab", tab_funcs, 0); 229 luaL_opennamedlib(L, LUA_TABLIBNAME, tab_funcs, 0);
230 return 0; 230 return 0;
231} 231}
232 232
diff --git a/lualib.h b/lualib.h
index 6f2198b9..68d88d7e 100644
--- a/lualib.h
+++ b/lualib.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lualib.h,v 1.21 2001/03/26 14:31:49 roberto Exp roberto $ 2** $Id: lualib.h,v 1.22 2002/04/09 20:19:06 roberto Exp roberto $
3** Lua standard libraries 3** Lua standard libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -18,11 +18,23 @@
18 18
19#define LUA_ALERT "_ALERT" 19#define LUA_ALERT "_ALERT"
20 20
21#define LUA_COLIBNAME "coroutine"
21LUALIB_API int lua_baselibopen (lua_State *L); 22LUALIB_API int lua_baselibopen (lua_State *L);
23
24#define LUA_TABLIBNAME "table"
22LUALIB_API int lua_tablibopen (lua_State *L); 25LUALIB_API int lua_tablibopen (lua_State *L);
26
27#define LUA_IOLIBNAME "io"
28#define LUA_OSLIBNAME "os"
23LUALIB_API int lua_iolibopen (lua_State *L); 29LUALIB_API int lua_iolibopen (lua_State *L);
30
31#define LUA_STRLIBNAME "string"
24LUALIB_API int lua_strlibopen (lua_State *L); 32LUALIB_API int lua_strlibopen (lua_State *L);
33
34#define LUA_MATHLIBNAME "math"
25LUALIB_API int lua_mathlibopen (lua_State *L); 35LUALIB_API int lua_mathlibopen (lua_State *L);
36
37#define LUA_DBLIBNAME "debug"
26LUALIB_API int lua_dblibopen (lua_State *L); 38LUALIB_API int lua_dblibopen (lua_State *L);
27 39
28 40