new name for `lua_[sg]etglobaltable'

This commit is contained in:
Roberto Ierusalimschy 2000-08-14 16:18:14 -03:00
parent 5d9cbdadfb
commit ddc8d94a08
5 changed files with 23 additions and 23 deletions

10
lapi.c
View File

@ -1,5 +1,5 @@
/*
** $Id: lapi.c,v 1.85 2000/06/12 13:52:05 roberto Exp roberto $
** $Id: lapi.c,v 1.86 2000/08/09 19:16:57 roberto Exp roberto $
** Lua API
** See Copyright Notice in lua.h
*/
@ -61,14 +61,14 @@ lua_Object lua_pop (lua_State *L) {
}
void lua_pushglobaltable (lua_State *L) {
void lua_pushglobals (lua_State *L) {
hvalue(L->top) = L->gt;
ttype(L->top) = TAG_TABLE;
incr_top;
}
void lua_setglobaltable (lua_State *L, lua_Object newtable) {
void lua_setglobals (lua_State *L, lua_Object newtable) {
if (lua_type(L, newtable)[0] != 't') /* type == "table"? */
lua_error(L, "Lua API error - invalid value for global table");
L->gt = hvalue(newtable);
@ -365,7 +365,7 @@ int lua_next (lua_State *L, lua_Object t, int i) {
*/
lua_Object lua_rawgetglobal (lua_State *L, const char *name) {
lua_pushglobaltable(L);
lua_pushglobals(L);
lua_pushstring(L, name);
return lua_rawget(L);
}
@ -375,7 +375,7 @@ void lua_rawsetglobal (lua_State *L, const char *name) {
lua_Object value;
lua_beginblock(L);
value = lua_pop(L);
lua_pushglobaltable(L);
lua_pushglobals(L);
lua_pushstring(L, name);
lua_pushobject(L, value);
lua_rawset(L);

View File

@ -1,5 +1,5 @@
/*
** $Id: lbuiltin.c,v 1.118 2000/08/04 19:38:35 roberto Exp roberto $
** $Id: lbuiltin.c,v 1.119 2000/08/09 19:16:57 roberto Exp roberto $
** Built-in functions
** See Copyright Notice in lua.h
*/
@ -101,7 +101,7 @@ void luaB__ALERT (lua_State *L) {
*/
void luaB__ERRORMESSAGE (lua_State *L) {
lua_Object al;
lua_pushglobaltable(L);
lua_pushglobals(L);
lua_pushstring(L, LUA_ALERT);
al = lua_rawget(L);
if (lua_isfunction(L, al)) { /* avoid error loop if _ALERT is not defined */
@ -206,9 +206,9 @@ void luaB_copytagmethods (lua_State *L) {
}
void luaB_globals (lua_State *L) {
lua_pushglobaltable(L);
lua_pushglobals(L);
if (lua_getparam(L, 1) != LUA_NOOBJECT)
lua_setglobaltable(L, luaL_tablearg(L, 1));
lua_setglobals(L, luaL_tablearg(L, 1));
}
void luaB_rawget (lua_State *L) {

View File

@ -1,5 +1,5 @@
/*
** $Id: liolib.c,v 1.68 2000/06/20 17:13:21 roberto Exp roberto $
** $Id: liolib.c,v 1.69 2000/08/09 19:16:57 roberto Exp roberto $
** Standard I/O (and system) library
** See Copyright Notice in lua.h
*/
@ -73,7 +73,7 @@ static void atribTM (lua_State *L) {
ctrl->file[inout] = (FILE *)lua_getuserdata(L, newvalue);
}
/* set the actual variable */
lua_pushglobaltable(L);
lua_pushglobals(L);
lua_pushstring(L, varname);
lua_pushobject(L, newvalue);
lua_rawset(L);
@ -590,7 +590,7 @@ static void errorfb (lua_State *L) {
sprintf(buff+strlen(buff), " [%.70s]", buffchunk);
strcat(buff, "\n");
}
lua_pushglobaltable(L);
lua_pushglobals(L);
lua_pushstring(L, LUA_ALERT);
alertfunc = lua_rawget(L);
if (lua_isfunction(L, alertfunc)) { /* avoid loop if _ALERT is not defined */

10
lua.h
View File

@ -1,5 +1,5 @@
/*
** $Id: lua.h,v 1.56 2000/08/07 18:39:16 roberto Exp roberto $
** $Id: lua.h,v 1.57 2000/08/09 19:16:57 roberto Exp roberto $
** Lua - An Extensible Extension Language
** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil
** e-mail: lua@tecgraf.puc-rio.br
@ -71,8 +71,8 @@ int lua_callfunction (lua_State *L, lua_Object f);
void lua_beginblock (lua_State *L);
void lua_endblock (lua_State *L);
void lua_pushglobaltable (lua_State *L);
void lua_setglobaltable (lua_State *L, lua_Object newtable);
void lua_pushglobals (lua_State *L);
void lua_setglobals (lua_State *L, lua_Object newtable);
lua_Object lua_lua2C (lua_State *L, int number);
#define lua_getparam lua_lua2C
@ -186,8 +186,8 @@ extern lua_State *lua_state;
#define lua_callfunction(f) (lua_callfunction)(lua_state, f)
#define lua_beginblock() (lua_beginblock)(lua_state)
#define lua_endblock() (lua_endblock)(lua_state)
#define lua_pushglobaltable() (lua_pushglobaltable)(lua_state)
#define lua_setglobaltable(t) (lua_setglobaltable)(lua_state, t)
#define lua_pushglobals() (lua_pushglobals)(lua_state)
#define lua_setglobals(t) (lua_setglobals)(lua_state, t)
#define lua_lua2C(number) (lua_lua2C)(lua_state, number)
#define lua_type(obj) (lua_type)(lua_state, obj)
#define lua_isnil(obj) (lua_isnil)(lua_state, obj)

View File

@ -1,4 +1,4 @@
% $Id: manual.tex,v 1.39 2000/05/24 13:54:49 roberto Exp roberto $
% $Id: manual.tex,v 1.40 2000/08/09 19:09:20 roberto Exp roberto $
\documentclass[11pt]{article}
\usepackage{fullpage,bnf}
@ -122,7 +122,7 @@ Waldemar Celes
\tecgraf\ --- Computer Science Department --- PUC-Rio
}
\date{{\small \tt\$Date: 2000/05/24 13:54:49 $ $}}
\date{{\small \tt\$Date: 2000/08/09 19:09:20 $ $}}
\maketitle
@ -1933,15 +1933,15 @@ use the \emph{lua_rawset} function over the table of globals.
To get the table of globals,
you should call
\Deffunc{lua_pushglobaltable}
\Deffunc{lua_pushglobals}
\begin{verbatim}
void lua_pushglobaltable (lua_State *L);
void lua_pushglobals (lua_State *L);
\end{verbatim}
To set another table as the table of globals,
you use
\Deffunc{lua_setglobaltable}
\Deffunc{lua_setglobals}
\begin{verbatim}
void lua_setglobaltable (lua_State *L, lua_Object newtable);
void lua_setglobals (lua_State *L, lua_Object newtable);
\end{verbatim}
Tables can also be manipulated via the API.