summaryrefslogtreecommitdiff
path: root/ltm.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-12-11 15:21:11 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-12-11 15:21:11 -0200
commit4daae2165d617e57ad1460471f8d902d38abac6e (patch)
tree84eb55fa794a864ac48b528a617d5293502190ea /ltm.c
parentcdd261f332c112b86eddd7438b9a06e1231e3e4c (diff)
downloadlua-4daae2165d617e57ad1460471f8d902d38abac6e.tar.gz
lua-4daae2165d617e57ad1460471f8d902d38abac6e.tar.bz2
lua-4daae2165d617e57ad1460471f8d902d38abac6e.zip
new API function and built-in "lua_copytagmethods"
Diffstat (limited to 'ltm.c')
-rw-r--r--ltm.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/ltm.c b/ltm.c
index ac2160ac..ff01f27a 100644
--- a/ltm.c
+++ b/ltm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltm.c,v 1.9 1997/11/19 18:16:33 roberto Exp roberto $ 2** $Id: ltm.c,v 1.10 1997/12/11 14:48:46 roberto Exp roberto $
3** Tag methods 3** Tag methods
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -46,7 +46,7 @@ static char validevents[NUM_TAGS][IM_N] = { /* ORDER LUA_T, ORDER IM */
46}; 46};
47 47
48 48
49static int validevent (lua_Type t, int e) 49static int validevent (int t, int e)
50{ /* ORDER LUA_T */ 50{ /* ORDER LUA_T */
51 return (t < LUA_T_NIL) ? 1 : validevents[-t][e]; 51 return (t < LUA_T_NIL) ? 1 : validevents[-t][e];
52} 52}
@@ -95,6 +95,18 @@ void luaT_realtag (int tag)
95} 95}
96 96
97 97
98int lua_copytagmethods (int tagto, int tagfrom)
99{
100 int e;
101 checktag(tagto);
102 checktag(tagfrom);
103 for (e=0; e<IM_N; e++) {
104 if (validevent(tagto, e))
105 *luaT_getim(tagto, e) = *luaT_getim(tagfrom, e);
106 }
107 return tagto;
108}
109
98 110
99int luaT_efectivetag (TObject *o) 111int luaT_efectivetag (TObject *o)
100{ 112{