summaryrefslogtreecommitdiff
path: root/liolib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-05-26 16:17:57 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-05-26 16:17:57 -0300
commit8e617985fab860fcd045f6f345ef47b159446d3b (patch)
treeb4b094aae7e962ea6e4a8f68c8f5dd31f97d4fdf /liolib.c
parentc39345fba361257bc426cd042a39691a0d68d68a (diff)
downloadlua-8e617985fab860fcd045f6f345ef47b159446d3b.tar.gz
lua-8e617985fab860fcd045f6f345ef47b159446d3b.tar.bz2
lua-8e617985fab860fcd045f6f345ef47b159446d3b.zip
functions `for...' and `raw...' are obsolete now
Diffstat (limited to 'liolib.c')
-rw-r--r--liolib.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/liolib.c b/liolib.c
index dbf853ad..541ce255 100644
--- a/liolib.c
+++ b/liolib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: liolib.c,v 1.63 2000/05/09 14:50:16 roberto Exp roberto $ 2** $Id: liolib.c,v 1.64 2000/05/24 13:54:49 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*/
@@ -73,8 +73,10 @@ static void atribTM (lua_State *L) {
73 ctrl->file[inout] = (FILE *)lua_getuserdata(L, newvalue); 73 ctrl->file[inout] = (FILE *)lua_getuserdata(L, newvalue);
74 } 74 }
75 /* set the actual variable */ 75 /* set the actual variable */
76 lua_pushglobaltable(L);
77 lua_pushstring(L, varname);
76 lua_pushobject(L, newvalue); 78 lua_pushobject(L, newvalue);
77 lua_rawsetglobal(L, varname); 79 lua_rawset(L);
78} 80}
79 81
80 82
@@ -541,7 +543,7 @@ static void errorfb (lua_State *L) {
541 char buff[MAXMESSAGE]; 543 char buff[MAXMESSAGE];
542 int level = 1; /* skip level 0 (it's this function) */ 544 int level = 1; /* skip level 0 (it's this function) */
543 lua_Debug ar; 545 lua_Debug ar;
544 lua_Object alertfunc = lua_rawgetglobal(L, LUA_ALERT); 546 lua_Object alertfunc;
545 sprintf(buff, "error: %.200s\n", lua_getstring(L, lua_getparam(L, 1))); 547 sprintf(buff, "error: %.200s\n", lua_getstring(L, lua_getparam(L, 1)));
546 while (lua_getstack(L, level++, &ar)) { 548 while (lua_getstack(L, level++, &ar)) {
547 char buffchunk[60]; 549 char buffchunk[60];
@@ -580,6 +582,9 @@ static void errorfb (lua_State *L) {
580 sprintf(buff+strlen(buff), " [%.70s]", buffchunk); 582 sprintf(buff+strlen(buff), " [%.70s]", buffchunk);
581 strcat(buff, "\n"); 583 strcat(buff, "\n");
582 } 584 }
585 lua_pushglobaltable(L);
586 lua_pushstring(L, LUA_ALERT);
587 alertfunc = lua_rawget(L);
583 if (lua_isfunction(L, alertfunc)) { /* avoid loop if _ALERT is not defined */ 588 if (lua_isfunction(L, alertfunc)) { /* avoid loop if _ALERT is not defined */
584 lua_pushstring(L, buff); 589 lua_pushstring(L, buff);
585 lua_callfunction(L, alertfunc); 590 lua_callfunction(L, alertfunc);