summaryrefslogtreecommitdiff
path: root/plugins/lua/elua.h
diff options
context:
space:
mode:
authorLuis Ontanon <luis.ontanon@gmail.com>2006-03-12 15:31:33 +0000
committerLuis Ontanon <luis.ontanon@gmail.com>2006-03-12 15:31:33 +0000
commit5ca4b6827251b0b9d6da3654d9091241994f750e (patch)
tree1fd40bff3c90d6bd7007efe34a2194be95a4bafa /plugins/lua/elua.h
parent72c79c1289a0f97d36eb88233ef4abd080d57aef (diff)
downloadwireshark-5ca4b6827251b0b9d6da3654d9091241994f750e.tar.gz
reenable TreeItem,
shiftXXX() was broken svn path=/trunk/; revision=17599
Diffstat (limited to 'plugins/lua/elua.h')
-rw-r--r--plugins/lua/elua.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/plugins/lua/elua.h b/plugins/lua/elua.h
index 2ddf7113d5..7d6f19cb80 100644
--- a/plugins/lua/elua.h
+++ b/plugins/lua/elua.h
@@ -177,12 +177,13 @@ gboolean is##C(lua_State* L,int i) { \
} \
C shift##C(lua_State* L,int i) { \
C* p; \
- if ((p = (C*)luaL_checkudata(L, i, #C))) {\
- lua_remove(L,i); \
- return *p; \
- } else { \
- return NULL; \
- } \
+ if(!lua_isuserdata(L,i)) return NULL; \
+ p = lua_touserdata(L, i); \
+ lua_getfield(L, LUA_REGISTRYINDEX, #C); \
+ if (p == NULL || !lua_getmetatable(L, i) || !lua_rawequal(L, -1, -2)) p=NULL; \
+ lua_pop(L, 2); \
+ if (p) { lua_remove(L,i); return *p; }\
+ else return NULL;\
}