luaL_dofile' and luaL_dostring' are deprecated

This commit is contained in:
Roberto Ierusalimschy
2004-05-31 16:27:14 -03:00
parent 616438fe9a
commit 1e0aaf2156
3 changed files with 9 additions and 63 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: lauxlib.c,v 1.111 2004/04/30 20:13:38 roberto Exp roberto $
** $Id: lauxlib.c,v 1.112 2004/05/10 17:50:51 roberto Exp roberto $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
@@ -555,6 +555,7 @@ LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t size,
return lua_load(L, getS, &ls, name);
}
/* }====================================================== */
@@ -573,51 +574,3 @@ LUALIB_API lua_State *luaL_newstate (void) {
return lua_newstate(l_alloc, NULL);
}
/*
** {======================================================
** compatibility code
** =======================================================
*/
static void callalert (lua_State *L, int status) {
if (status != 0) {
lua_getglobal(L, "_ALERT");
if (lua_isfunction(L, -1)) {
lua_insert(L, -2);
lua_call(L, 1, 0);
}
else { /* no _ALERT function; print it on stderr */
fprintf(stderr, "%s\n", lua_tostring(L, -2));
lua_pop(L, 2); /* remove error message and _ALERT */
}
}
}
static int aux_do (lua_State *L, int status) {
if (status == 0) { /* parse OK? */
status = lua_pcall(L, 0, LUA_MULTRET, 0); /* call main */
}
callalert(L, status);
return status;
}
LUALIB_API int lua_dofile (lua_State *L, const char *filename) {
return aux_do(L, luaL_loadfile(L, filename));
}
LUALIB_API int lua_dobuffer (lua_State *L, const char *buff, size_t size,
const char *name) {
return aux_do(L, luaL_loadbuffer(L, buff, size, name));
}
LUALIB_API int lua_dostring (lua_State *L, const char *str) {
return lua_dobuffer(L, str, strlen(str), str);
}
/* }====================================================== */