6 |
** $Id$ |
** $Id$ |
7 |
*/ |
*/ |
8 |
|
|
9 |
/* This code is free software; you can redistribute it and/or modify it. |
/* This code is free software; you can redistribute it and/or modify it. |
10 |
** The software provided hereunder is on an "as is" basis, and |
** The software provided hereunder is on an "as is" basis, and |
11 |
** the author has no obligation to provide maintenance, support, updates, |
** the author has no obligation to provide maintenance, support, updates, |
12 |
** enhancements, or modifications. |
** enhancements, or modifications. |
13 |
*/ |
*/ |
14 |
|
|
15 |
#include "tolua.h" |
#include "tolua.h" |
50 |
lua_pushvalue(L,derived); |
lua_pushvalue(L,derived); |
51 |
lua_pushstring(L,".base"); |
lua_pushstring(L,".base"); |
52 |
lua_pushvalue(L,base); |
lua_pushvalue(L,base); |
53 |
lua_rawset(L,-3); |
lua_rawset(L,-3); |
54 |
lua_pushstring(L,".itag"); |
lua_pushstring(L,".itag"); |
55 |
lua_pushnumber(L,tag); |
lua_pushnumber(L,tag); |
56 |
lua_rawset(L,-3); |
lua_rawset(L,-3); |
112 |
return toluaI_tt_getobjtype(L,lo); |
return toluaI_tt_getobjtype(L,lo); |
113 |
} |
} |
114 |
|
|
115 |
int tolua_tag (lua_State* L, char* type) |
int tolua_tag (lua_State* L, const char* type) |
116 |
{ |
{ |
117 |
return toluaI_tt_gettag(L,type); |
return toluaI_tt_gettag(L,type); |
118 |
} |
} |
126 |
} |
} |
127 |
else if (lua_istable(L,lo)) |
else if (lua_istable(L,lo)) |
128 |
{ |
{ |
129 |
lua_pushvalue(L,lo); |
lua_pushvalue(L,lo); |
130 |
lua_pushstring(L,".base"); |
lua_pushstring(L,".base"); |
131 |
lua_rawget(L,-2); |
lua_rawget(L,-2); |
132 |
return -1; |
return -1; |
152 |
{ |
{ |
153 |
/* force garbage collection to avoid C to reuse a to-be-collected address */ |
/* force garbage collection to avoid C to reuse a to-be-collected address */ |
154 |
lua_setgcthreshold(L,0); |
lua_setgcthreshold(L,0); |
155 |
tolua_doclone(L,lua_touserdata(L,lo),lua_tag(L,lo)); |
tolua_doclone(L,lua_touserdata(L,lo),lua_tag(L,lo)); |
156 |
} |
} |
157 |
else |
else |
158 |
tolua_error(L,"cannot take ownership of specified obejct."); |
tolua_error(L,"cannot take ownership of specified obejct."); |