aboutsummaryrefslogtreecommitdiff
path: root/src/client/callbackhandeler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/callbackhandeler.cpp')
-rw-r--r--src/client/callbackhandeler.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/client/callbackhandeler.cpp b/src/client/callbackhandeler.cpp
index c548624..cf24cd2 100644
--- a/src/client/callbackhandeler.cpp
+++ b/src/client/callbackhandeler.cpp
@@ -31,6 +31,7 @@ GlobalEventReceiver::GlobalEventReceiver(IrrlichtDevice* d){
}
bool GlobalEventReceiver::OnEvent(const SEvent& e){
EEVENT_TYPE type = e.EventType;
+ //printf("Onevent called:%d\n",(int)type);
switch (type){
case EET_GUI_EVENT:{
IGUIElement* caller = e.GUIEvent.Caller;
@@ -48,12 +49,15 @@ bool GlobalEventReceiver::OnEvent(const SEvent& e){
SEvent::SMouseInput se = e.MouseInput;
//printf("X: %d Y: %d\n",se.X, se.Y);
- lua_getglobal(L,"GAME");
- lua_getfield(L,-1,"onMouseMove");
+ lua_getglobal(L,"GAME");//{}
+ lua_getfield(L,-1,"onMouseMove");//{},onMouseMove()
if(!lua_isnil(L,-1)){
lua_pushnumber(L,se.X);
lua_pushnumber(L,se.Y);
lua_call(L,2,0);
+ lua_pop(L,1);
+ }else{
+ lua_pop(L,2);
}
break;
}
@@ -68,11 +72,14 @@ bool GlobalEventReceiver::OnEvent(const SEvent& e){
lua_pushboolean(L,se.Control);
lua_pushboolean(L,se.Shift);
lua_call(L,4,0);
+ lua_pop(L,1);
+ }else{
+ lua_pop(L,2);
}
break;
}
default:
- //printf("Called an unknown event\n");
+ printf("Called an unknown event\n");
return false;
}
}