1
0
mirror of https://github.com/lua/lua.git synced 2025-01-28 06:03:00 +08:00

for security reasons, one cannot change the tag of a udata

from Lua.
This commit is contained in:
Roberto Ierusalimschy 1997-06-27 19:38:49 -03:00
parent 20a48a818f
commit ef3c45d523
2 changed files with 9 additions and 9 deletions

View File

@ -5,7 +5,7 @@
** Also provides some predefined lua functions. ** Also provides some predefined lua functions.
*/ */
char *rcs_inout="$Id: inout.c,v 2.67 1997/06/23 18:27:53 roberto Exp roberto $"; char *rcs_inout="$Id: inout.c,v 2.68 1997/06/26 20:47:43 roberto Exp roberto $";
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -313,7 +313,7 @@ static void luaI_call (void)
static void luaIl_settag (void) static void luaIl_settag (void)
{ {
lua_Object o = lua_getparam(1); lua_Object o = lua_getparam(1);
luaL_arg_check(o != LUA_NOOBJECT, 1, NULL); luaL_arg_check(lua_istable(o), 1, "table expected");
lua_pushobject(o); lua_pushobject(o);
lua_settag(luaL_check_number(2)); lua_settag(luaL_check_number(2));
} }

View File

@ -1,4 +1,4 @@
% $Id: manual.tex,v 2.6 1997/06/26 20:39:10 roberto Exp roberto $ % $Id: manual.tex,v 2.7 1997/06/27 18:39:34 roberto Exp roberto $
\documentstyle[fullpage,11pt,bnf]{article} \documentstyle[fullpage,11pt,bnf]{article}
@ -38,7 +38,7 @@ Waldemar Celes
\tecgraf\ --- Computer Science Department --- PUC-Rio \tecgraf\ --- Computer Science Department --- PUC-Rio
} }
\date{\small \verb$Date: 1997/06/26 20:39:10 $} \date{\small \verb$Date: 1997/06/27 18:39:34 $}
\maketitle \maketitle
@ -263,7 +263,7 @@ values of type userdata and table can have
as many different tags as needed \see{tag-method}. as many different tags as needed \see{tag-method}.
Tags are created with the function \verb|newtag|, Tags are created with the function \verb|newtag|,
and the function \verb|tag| returns the tag of a given value. and the function \verb|tag| returns the tag of a given value.
To change the tag of a given userdata or table, To change the tag of a given table,
there is the function \verb|settag| \see{pdf-newtag}. there is the function \verb|settag| \see{pdf-newtag}.
@ -1723,12 +1723,12 @@ This function allows Lua to test the tag of a value \see{TypesSec}.
It receives one argument, and returns its tag (a number). It receives one argument, and returns its tag (a number).
\verb|tag| is equivalent to the API function \verb|lua_tag|. \verb|tag| is equivalent to the API function \verb|lua_tag|.
\subsubsection*{\ff {\tt settag (o, tag)}}\Deffunc{settag} \subsubsection*{\ff {\tt settag (t, tag)}}\Deffunc{settag}
This function sets the tag of a given object \see{TypesSec}. This function sets the tag of a given table \see{TypesSec}.
The object \verb|o| must be a userdata or a table.
\verb|tag| must be a value created with \verb|newtag| \verb|tag| must be a value created with \verb|newtag|
\see{pdf-newtag}. \see{pdf-newtag}.
\verb|settag| is equivalent to the API function \verb|lua_settag|. For security reasons,
it is impossible to change the tag of a userdata from Lua.
\subsubsection*{\ff {\tt assert (v)}}\Deffunc{assert} \subsubsection*{\ff {\tt assert (v)}}\Deffunc{assert}
This function issues an {\em ``assertion failed!''} error This function issues an {\em ``assertion failed!''} error