aboutsummaryrefslogtreecommitdiff
path: root/iolib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1996-04-30 18:13:55 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1996-04-30 18:13:55 -0300
commit3ec9ee0d0f81fd0aabaef1303f971b2f7ee12315 (patch)
tree07c3b5bdd856340429a3567212fc86fe80fdd005 /iolib.c
parent21c9ebf4a9891786d5683537868cc348340ca89d (diff)
downloadlua-3ec9ee0d0f81fd0aabaef1303f971b2f7ee12315.tar.gz
lua-3ec9ee0d0f81fd0aabaef1303f971b2f7ee12315.tar.bz2
lua-3ec9ee0d0f81fd0aabaef1303f971b2f7ee12315.zip
new function "luaI_openlib" to help open libs.
Diffstat (limited to 'iolib.c')
-rw-r--r--iolib.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/iolib.c b/iolib.c
index cdbe3447..a5c26a0e 100644
--- a/iolib.c
+++ b/iolib.c
@@ -3,7 +3,7 @@
3** Input/output library to LUA 3** Input/output library to LUA
4*/ 4*/
5 5
6char *rcs_iolib="$Id: iolib.c,v 1.41 1996/04/22 19:28:37 roberto Exp roberto $"; 6char *rcs_iolib="$Id: iolib.c,v 1.42 1996/04/23 12:43:07 roberto Exp roberto $";
7 7
8#include <stdio.h> 8#include <stdio.h>
9#include <ctype.h> 9#include <ctype.h>
@@ -593,27 +593,27 @@ static void errorfb (void)
593} 593}
594 594
595 595
596/* 596static struct lua_reg iolib[] = {
597** Open io library 597{"readfrom", io_readfrom},
598*/ 598{"writeto", io_writeto},
599{"appendto", io_appendto},
600{"read", io_read},
601{"readuntil",io_readuntil},
602{"write", io_write},
603{"execute", io_execute},
604{"remove", io_remove},
605{"rename", io_rename},
606{"tmpname", io_tmpname},
607{"ioerror", io_errorno},
608{"getenv", io_getenv},
609{"date", io_date},
610{"exit", io_exit},
611{"debug", io_debug},
612{"print_stack", errorfb}
613};
614
599void iolib_open (void) 615void iolib_open (void)
600{ 616{
601 lua_register ("readfrom", io_readfrom); 617 luaI_openlib(iolib, (sizeof(iolib)/sizeof(iolib[0])));
602 lua_register ("writeto", io_writeto); 618 lua_setfallback("error", errorfb);
603 lua_register ("appendto", io_appendto);
604 lua_register ("read", io_read);
605 lua_register ("readuntil",io_readuntil);
606 lua_register ("write", io_write);
607 lua_register ("execute", io_execute);
608 lua_register ("remove", io_remove);
609 lua_register ("rename", io_rename);
610 lua_register ("tmpname", io_tmpname);
611 lua_register ("ioerror", io_errorno);
612 lua_register ("getenv", io_getenv);
613 lua_register ("date", io_date);
614 lua_register ("exit", io_exit);
615 lua_register ("debug", io_debug);
616 lua_register ("print_stack", errorfb);
617 lua_setfallback("error", errorfb);
618} 619}
619