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-github-8e617985fab860fcd045f6f345ef47b159446d3b.tar.gz
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 @@
/*
-** $Id: liolib.c,v 1.63 2000/05/09 14:50:16 roberto Exp roberto $
+** $Id: liolib.c,v 1.64 2000/05/24 13:54:49 roberto Exp roberto $
** Standard I/O (and system) library
** See Copyright Notice in lua.h
*/
@@ -73,8 +73,10 @@ static void atribTM (lua_State *L) {
ctrl->file[inout] = (FILE *)lua_getuserdata(L, newvalue);
}
/* set the actual variable */
+ lua_pushglobaltable(L);
+ lua_pushstring(L, varname);
lua_pushobject(L, newvalue);
- lua_rawsetglobal(L, varname);
+ lua_rawset(L);
}
@@ -541,7 +543,7 @@ static void errorfb (lua_State *L) {
char buff[MAXMESSAGE];
int level = 1; /* skip level 0 (it's this function) */
lua_Debug ar;
- lua_Object alertfunc = lua_rawgetglobal(L, LUA_ALERT);
+ lua_Object alertfunc;
sprintf(buff, "error: %.200s\n", lua_getstring(L, lua_getparam(L, 1)));
while (lua_getstack(L, level++, &ar)) {
char buffchunk[60];
@@ -580,6 +582,9 @@ static void errorfb (lua_State *L) {
sprintf(buff+strlen(buff), " [%.70s]", buffchunk);
strcat(buff, "\n");
}
+ lua_pushglobaltable(L);
+ lua_pushstring(L, LUA_ALERT);
+ alertfunc = lua_rawget(L);
if (lua_isfunction(L, alertfunc)) { /* avoid loop if _ALERT is not defined */
lua_pushstring(L, buff);
lua_callfunction(L, alertfunc);