Merge pull request #77 from uudiin/master
remove two functions conflict with lua5.1 and luajit
This commit is contained in:
commit
90c177740f
@ -58,30 +58,6 @@ void lua_rawsetp (lua_State *L, int index, const void *p){
|
||||
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
|
||||
|
||||
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 */
|
||||
|
||||
/* 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_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 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
|
||||
|
||||
int lutil_newmetatablep (lua_State *L, const void *p);
|
||||
|
@ -1029,7 +1029,6 @@ static int lcurl_easy_pause(lua_State *L){
|
||||
}
|
||||
|
||||
static int lcurl_easy_setdata(lua_State *L){
|
||||
lcurl_easy_t *p = lcurl_geteasy(L);
|
||||
lua_settop(L, 2);
|
||||
lua_pushvalue(L, 1);
|
||||
lua_insert(L, 2);
|
||||
@ -1038,7 +1037,6 @@ static int lcurl_easy_setdata(lua_State *L){
|
||||
}
|
||||
|
||||
static int lcurl_easy_getdata(lua_State *L){
|
||||
lcurl_easy_t *p = lcurl_geteasy(L);
|
||||
lua_settop(L, 1);
|
||||
lua_rawget(L, LCURL_USERVALUES);
|
||||
return 1;
|
||||
|
@ -462,7 +462,6 @@ static int lcurl_multi_setopt(lua_State *L){
|
||||
}
|
||||
|
||||
static int lcurl_multi_setdata(lua_State *L){
|
||||
lcurl_multi_t *p = lcurl_getmulti(L);
|
||||
lua_settop(L, 2);
|
||||
lua_pushvalue(L, 1);
|
||||
lua_insert(L, 2);
|
||||
@ -471,7 +470,6 @@ static int lcurl_multi_setdata(lua_State *L){
|
||||
}
|
||||
|
||||
static int lcurl_multi_getdata(lua_State *L){
|
||||
lcurl_multi_t *p = lcurl_getmulti(L);
|
||||
lua_settop(L, 1);
|
||||
lua_rawget(L, LCURL_USERVALUES);
|
||||
return 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user