Skip to content

Commit 0eba3a8

Browse files
committed
remove two functions conflict with lua5.1 and luajit
1 parent 98ec221 commit 0eba3a8

File tree

2 files changed

+1
-28
lines changed

2 files changed

+1
-28
lines changed

src/l52util.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -58,30 +58,6 @@ void lua_rawsetp (lua_State *L, int index, const void *p){
5858
lua_rawset(L, index);
5959
}
6060

61-
int luaL_getmetafield (lua_State *L, int obj, const char *event) {
62-
if (!lua_getmetatable(L, obj)) /* no metatable? */
63-
return 0;
64-
lua_pushstring(L, event);
65-
lua_rawget(L, -2);
66-
if (lua_isnil(L, -1)) {
67-
lua_pop(L, 2); /* remove metatable and metafield */
68-
return 0;
69-
}
70-
else {
71-
lua_remove(L, -2); /* remove only metatable */
72-
return 1;
73-
}
74-
}
75-
76-
int luaL_callmeta (lua_State *L, int obj, const char *event) {
77-
obj = lua_absindex(L, obj);
78-
if (!luaL_getmetafield(L, obj, event)) /* no metafield? */
79-
return 0;
80-
lua_pushvalue(L, obj);
81-
lua_call(L, 1, 1);
82-
return 1;
83-
}
84-
8561
#endif
8662

8763
int lutil_newmetatablep (lua_State *L, const void *p) {

src/l52util.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void luaL_register (lua_State *L, const char *libname, const luaL_Reg *l);
5858

5959
#else /* Lua 5.1 */
6060

61-
/* functions form lua 5.2 */
61+
/* functions from lua 5.2 */
6262

6363
# define lua_absindex(L, i) (((i)>0)?(i):((i)<=LUA_REGISTRYINDEX?(i):(lua_gettop(L)+(i)+1)))
6464
# define lua_rawlen lua_objlen
@@ -67,9 +67,6 @@ void lua_rawgetp (lua_State *L, int index, const void *p);
6767
void lua_rawsetp (lua_State *L, int index, const void *p);
6868
void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup);
6969

70-
int luaL_getmetafield (lua_State *L, int obj, const char *event);
71-
int luaL_callmeta (lua_State *L, int obj, const char *event);
72-
7370
#endif
7471

7572
int lutil_newmetatablep (lua_State *L, const void *p);

0 commit comments

Comments
 (0)