remove two functions conflict with lua5.1 and luajit
This commit is contained in:
parent
98ec2217ea
commit
0eba3a8402
@ -58,30 +58,6 @@ void lua_rawsetp (lua_State *L, int index, const void *p){
|
|||||||
lua_rawset(L, index);
|
lua_rawset(L, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
int luaL_getmetafield (lua_State *L, int obj, const char *event) {
|
|
||||||
if (!lua_getmetatable(L, obj)) /* no metatable? */
|
|
||||||
return 0;
|
|
||||||
lua_pushstring(L, event);
|
|
||||||
lua_rawget(L, -2);
|
|
||||||
if (lua_isnil(L, -1)) {
|
|
||||||
lua_pop(L, 2); /* remove metatable and metafield */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
lua_remove(L, -2); /* remove only metatable */
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int luaL_callmeta (lua_State *L, int obj, const char *event) {
|
|
||||||
obj = lua_absindex(L, obj);
|
|
||||||
if (!luaL_getmetafield(L, obj, event)) /* no metafield? */
|
|
||||||
return 0;
|
|
||||||
lua_pushvalue(L, obj);
|
|
||||||
lua_call(L, 1, 1);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int lutil_newmetatablep (lua_State *L, const void *p) {
|
int lutil_newmetatablep (lua_State *L, const void *p) {
|
||||||
|
@ -58,7 +58,7 @@ void luaL_register (lua_State *L, const char *libname, const luaL_Reg *l);
|
|||||||
|
|
||||||
#else /* Lua 5.1 */
|
#else /* Lua 5.1 */
|
||||||
|
|
||||||
/* functions form lua 5.2 */
|
/* functions from lua 5.2 */
|
||||||
|
|
||||||
# define lua_absindex(L, i) (((i)>0)?(i):((i)<=LUA_REGISTRYINDEX?(i):(lua_gettop(L)+(i)+1)))
|
# define lua_absindex(L, i) (((i)>0)?(i):((i)<=LUA_REGISTRYINDEX?(i):(lua_gettop(L)+(i)+1)))
|
||||||
# define lua_rawlen lua_objlen
|
# define lua_rawlen lua_objlen
|
||||||
@ -67,9 +67,6 @@ void lua_rawgetp (lua_State *L, int index, const void *p);
|
|||||||
void lua_rawsetp (lua_State *L, int index, const void *p);
|
void lua_rawsetp (lua_State *L, int index, const void *p);
|
||||||
void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup);
|
void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup);
|
||||||
|
|
||||||
int luaL_getmetafield (lua_State *L, int obj, const char *event);
|
|
||||||
int luaL_callmeta (lua_State *L, int obj, const char *event);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int lutil_newmetatablep (lua_State *L, const void *p);
|
int lutil_newmetatablep (lua_State *L, const void *p);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user