mirror of
https://github.com/lua/lua
synced 2024-11-22 21:01:26 +03:00
function 'lua_addfile' returns an error message
This commit is contained in:
parent
6b18cc9a17
commit
852d9a8597
18
table.c
18
table.c
@ -3,7 +3,7 @@
|
||||
** Module to control static tables
|
||||
*/
|
||||
|
||||
char *rcs_table="$Id: table.c,v 2.7 1994/11/02 19:09:23 roberto Exp roberto $";
|
||||
char *rcs_table="$Id: table.c,v 2.8 1994/11/02 20:29:09 roberto Exp roberto $";
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -233,21 +233,15 @@ char *lua_createstring (char *s)
|
||||
/*
|
||||
** Add a file name at file table, checking overflow. This function also set
|
||||
** the external variable "lua_filename" with the function filename set.
|
||||
** Return 0 on success or 1 on error.
|
||||
** Return 0 on success or error message on error.
|
||||
*/
|
||||
int lua_addfile (char *fn)
|
||||
char *lua_addfile (char *fn)
|
||||
{
|
||||
if (lua_nfile >= MAXFILE-1)
|
||||
{
|
||||
lua_error ("too many files");
|
||||
return 1;
|
||||
}
|
||||
return "too many files";
|
||||
if ((lua_file[lua_nfile++] = strdup (fn)) == NULL)
|
||||
{
|
||||
lua_error ("not enough memory");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
return "not enough memory";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
4
table.h
4
table.h
@ -1,7 +1,7 @@
|
||||
/*
|
||||
** Module to control static tables
|
||||
** TeCGraf - PUC-Rio
|
||||
** $Id: table.h,v 2.2 1994/07/19 21:27:18 celes Exp $
|
||||
** $Id: table.h,v 2.3 1994/10/17 19:03:23 celes Exp roberto $
|
||||
*/
|
||||
|
||||
#ifndef table_h
|
||||
@ -25,7 +25,7 @@ void lua_travsymbol (void (*fn)(Object *));
|
||||
void lua_markobject (Object *o);
|
||||
void lua_pack (void);
|
||||
char *lua_createstring (char *s);
|
||||
int lua_addfile (char *fn);
|
||||
char *lua_addfile (char *fn);
|
||||
int lua_delfile (void);
|
||||
char *lua_filename (void);
|
||||
void lua_nextvar (void);
|
||||
|
Loading…
Reference in New Issue
Block a user