summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2012-08-08 18:11:24 (GMT)
committer jacksonmj <mj-pt@jacksonmj.co.uk>2012-08-09 22:02:58 (GMT)
commitb3e393e162df2b7e848638489c4cb473ce65ba70 (patch)
tree3b1b9033e64e196b1d438b6346787e9c1521d1fe /src
parent45503b4b7b34a5ed6947fcad9780a017da87c867 (diff)
downloadpowder-b3e393e162df2b7e848638489c4cb473ce65ba70.zip
powder-b3e393e162df2b7e848638489c4cb473ce65ba70.tar.gz
Error reporting in other things besides just step functions
Diffstat (limited to 'src')
-rw-r--r--src/luaconsole.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/luaconsole.c b/src/luaconsole.c
index 13cdc3b..02b8514 100644
--- a/src/luaconsole.c
+++ b/src/luaconsole.c
@@ -691,7 +691,7 @@ int luacon_elementwrite(lua_State* l){
return 0;
}
int luacon_keyevent(int key, int modifier, int event){
- int i = 0, kpcontinue = 1;
+ int i = 0, kpcontinue = 1, callret;
char tempkey[] = {key, 0};
if(keypress_function_count){
for(i = 0; i < keypress_function_count && kpcontinue; i++){
@@ -700,7 +700,11 @@ int luacon_keyevent(int key, int modifier, int event){
lua_pushinteger(l, key);
lua_pushinteger(l, modifier);
lua_pushinteger(l, event);
- lua_pcall(l, 4, 1, 0);
+ callret = lua_pcall(l, 4, 1, 0);
+ if (callret)
+ {
+ printf("In key event: %s\n",luacon_geterror());
+ }
if(lua_isboolean(l, -1)){
kpcontinue = lua_toboolean(l, -1);
}
@@ -710,7 +714,7 @@ int luacon_keyevent(int key, int modifier, int event){
return kpcontinue;
}
int luacon_mouseevent(int mx, int my, int mb, int event, int mouse_wheel){
- int i = 0, mpcontinue = 1;
+ int i = 0, mpcontinue = 1, callret;
if(mouseclick_function_count){
for(i = 0; i < mouseclick_function_count && mpcontinue; i++){
lua_rawgeti(l, LUA_REGISTRYINDEX, mouseclick_functions[i]);
@@ -719,7 +723,11 @@ int luacon_mouseevent(int mx, int my, int mb, int event, int mouse_wheel){
lua_pushinteger(l, mb);
lua_pushinteger(l, event);
lua_pushinteger(l, mouse_wheel);
- lua_pcall(l, 5, 1, 0);
+ callret = lua_pcall(l, 5, 1, 0);
+ if (callret)
+ {
+ printf("In mouse event: %s\n",luacon_geterror());
+ }
if(lua_isboolean(l, -1)){
mpcontinue = lua_toboolean(l, -1);
}
@@ -779,7 +787,7 @@ void lua_hook(lua_State *L, lua_Debug *ar)
}
int luacon_part_update(int t, int i, int x, int y, int surround_space, int nt)
{
- int retval = 0;
+ int retval = 0, callret;
if(lua_el_func[t]){
lua_rawgeti(l, LUA_REGISTRYINDEX, lua_el_func[t]);
lua_pushinteger(l, i);
@@ -787,7 +795,11 @@ int luacon_part_update(int t, int i, int x, int y, int surround_space, int nt)
lua_pushinteger(l, y);
lua_pushinteger(l, surround_space);
lua_pushinteger(l, nt);
- lua_pcall(l, 5, 1, 0);
+ callret = lua_pcall(l, 5, 1, 0);
+ if (callret)
+ {
+ printf("In particle update: %s\n",luacon_geterror());
+ }
if(lua_isboolean(l, -1)){
retval = lua_toboolean(l, -1);
}
@@ -797,13 +809,17 @@ int luacon_part_update(int t, int i, int x, int y, int surround_space, int nt)
}
int luacon_graphics_update(int t, int i, int *pixel_mode, int *cola, int *colr, int *colg, int *colb, int *firea, int *firer, int *fireg, int *fireb)
{
- int cache = 0;
+ int cache = 0, callret;
lua_rawgeti(l, LUA_REGISTRYINDEX, lua_gr_func[t]);
lua_pushinteger(l, i);
lua_pushinteger(l, *colr);
lua_pushinteger(l, *colg);
lua_pushinteger(l, *colb);
- lua_pcall(l, 4, 10, 0);
+ callret = lua_pcall(l, 4, 10, 0);
+ if (callret)
+ {
+ printf("In graphics function: %s\n",luacon_geterror());
+ }
cache = luaL_optint(l, -10, 0);
*pixel_mode = luaL_optint(l, -9, *pixel_mode);