diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-03-18 12:30:50 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-03-18 12:30:50 -0300 |
commit | 2de803c250de373186afbbea0a5978f54c52850c (patch) | |
tree | a00499eac71bb427fd720e45bdfa2749dd134b51 /iolib.c | |
parent | fa08b42dd851ae945df9796438ac0565939a00f2 (diff) | |
download | lua-2de803c250de373186afbbea0a5978f54c52850c.tar.gz lua-2de803c250de373186afbbea0a5978f54c52850c.tar.bz2 lua-2de803c250de373186afbbea0a5978f54c52850c.zip |
new header 'auxlib.h' + new function luaL_verror
Diffstat (limited to 'iolib.c')
-rw-r--r-- | iolib.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -5,6 +5,7 @@ | |||
5 | #include <errno.h> | 5 | #include <errno.h> |
6 | 6 | ||
7 | #include "lua.h" | 7 | #include "lua.h" |
8 | #include "auxlib.h" | ||
8 | #include "luadebug.h" | 9 | #include "luadebug.h" |
9 | #include "lualib.h" | 10 | #include "lualib.h" |
10 | 11 | ||
@@ -234,13 +235,12 @@ static void io_debug (void) | |||
234 | 235 | ||
235 | static void lua_printstack (FILE *f) | 236 | static void lua_printstack (FILE *f) |
236 | { | 237 | { |
237 | int level = 0; | 238 | int level = 1; /* skip level 0 (it's this function) */ |
238 | lua_Object func; | 239 | lua_Object func; |
239 | fprintf(f, "Active Stack:\n"); | ||
240 | while ((func = lua_stackedfunction(level++)) != LUA_NOOBJECT) { | 240 | while ((func = lua_stackedfunction(level++)) != LUA_NOOBJECT) { |
241 | char *name; | 241 | char *name; |
242 | int currentline; | 242 | int currentline; |
243 | fprintf(f, "\t"); | 243 | fprintf(f, (level==2) ? "Active Stack:\n\t" : "\t"); |
244 | switch (*lua_getobjname(func, &name)) { | 244 | switch (*lua_getobjname(func, &name)) { |
245 | case 'g': | 245 | case 'g': |
246 | fprintf(f, "function %s", name); | 246 | fprintf(f, "function %s", name); |
@@ -275,7 +275,7 @@ static void errorfb (void) | |||
275 | } | 275 | } |
276 | 276 | ||
277 | 277 | ||
278 | static struct lua_reg iolib[] = { | 278 | static struct luaL_reg iolib[] = { |
279 | {"readfrom", io_readfrom}, | 279 | {"readfrom", io_readfrom}, |
280 | {"writeto", io_writeto}, | 280 | {"writeto", io_writeto}, |
281 | {"appendto", io_appendto}, | 281 | {"appendto", io_appendto}, |
@@ -295,6 +295,6 @@ static struct lua_reg iolib[] = { | |||
295 | void iolib_open (void) | 295 | void iolib_open (void) |
296 | { | 296 | { |
297 | lua_infile=stdin; lua_outfile=stdout; | 297 | lua_infile=stdin; lua_outfile=stdout; |
298 | luaI_openlib(iolib, (sizeof(iolib)/sizeof(iolib[0]))); | 298 | luaL_openlib(iolib, (sizeof(iolib)/sizeof(iolib[0]))); |
299 | lua_setfallback("error", errorfb); | 299 | lua_setglobalmethod("error", errorfb); |
300 | } | 300 | } |