TPT: Error reporting in other things besides just step functions (No error reporting in graphics or part update to prevent massive spam) fixes #134
This commit is contained in:
parent
9c599a7b9f
commit
13888623a5
@ -814,7 +814,7 @@ int luacon_elementwrite(lua_State* l){
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int luacon_keyevent(int key, int modifier, int event){
|
int luacon_keyevent(int key, int modifier, int event){
|
||||||
int i = 0, kpcontinue = 1;
|
int i = 0, kpcontinue = 1, callret;
|
||||||
char tempkey[] = {key, 0};
|
char tempkey[] = {key, 0};
|
||||||
if(keypress_function_count){
|
if(keypress_function_count){
|
||||||
for(i = 0; i < keypress_function_count && kpcontinue; i++){
|
for(i = 0; i < keypress_function_count && kpcontinue; i++){
|
||||||
@ -823,7 +823,11 @@ int luacon_keyevent(int key, int modifier, int event){
|
|||||||
lua_pushinteger(luacon_ci->l, key);
|
lua_pushinteger(luacon_ci->l, key);
|
||||||
lua_pushinteger(luacon_ci->l, modifier);
|
lua_pushinteger(luacon_ci->l, modifier);
|
||||||
lua_pushinteger(luacon_ci->l, event);
|
lua_pushinteger(luacon_ci->l, event);
|
||||||
lua_pcall(luacon_ci->l, 4, 1, 0);
|
callret = lua_pcall(luacon_ci->l, 4, 1, 0);
|
||||||
|
if (callret)
|
||||||
|
{
|
||||||
|
luacon_ci->Log(CommandInterface::LogError, luacon_geterror());
|
||||||
|
}
|
||||||
if(lua_isboolean(luacon_ci->l, -1)){
|
if(lua_isboolean(luacon_ci->l, -1)){
|
||||||
kpcontinue = lua_toboolean(luacon_ci->l, -1);
|
kpcontinue = lua_toboolean(luacon_ci->l, -1);
|
||||||
}
|
}
|
||||||
@ -833,7 +837,7 @@ int luacon_keyevent(int key, int modifier, int event){
|
|||||||
return kpcontinue;
|
return kpcontinue;
|
||||||
}
|
}
|
||||||
int luacon_mouseevent(int mx, int my, int mb, int event, int mouse_wheel){
|
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){
|
if(mouseclick_function_count){
|
||||||
for(i = 0; i < mouseclick_function_count && mpcontinue; i++){
|
for(i = 0; i < mouseclick_function_count && mpcontinue; i++){
|
||||||
lua_rawgeti(luacon_ci->l, LUA_REGISTRYINDEX, mouseclick_functions[i]);
|
lua_rawgeti(luacon_ci->l, LUA_REGISTRYINDEX, mouseclick_functions[i]);
|
||||||
@ -842,7 +846,11 @@ int luacon_mouseevent(int mx, int my, int mb, int event, int mouse_wheel){
|
|||||||
lua_pushinteger(luacon_ci->l, mb);
|
lua_pushinteger(luacon_ci->l, mb);
|
||||||
lua_pushinteger(luacon_ci->l, event);
|
lua_pushinteger(luacon_ci->l, event);
|
||||||
lua_pushinteger(luacon_ci->l, mouse_wheel);
|
lua_pushinteger(luacon_ci->l, mouse_wheel);
|
||||||
lua_pcall(luacon_ci->l, 5, 1, 0);
|
callret = lua_pcall(luacon_ci->l, 5, 1, 0);
|
||||||
|
if (callret)
|
||||||
|
{
|
||||||
|
luacon_ci->Log(CommandInterface::LogError, luacon_geterror());
|
||||||
|
}
|
||||||
if(lua_isboolean(luacon_ci->l, -1)){
|
if(lua_isboolean(luacon_ci->l, -1)){
|
||||||
mpcontinue = lua_toboolean(luacon_ci->l, -1);
|
mpcontinue = lua_toboolean(luacon_ci->l, -1);
|
||||||
}
|
}
|
||||||
@ -874,8 +882,7 @@ int luacon_step(int mx, int my, int selectl, int selectr, int bsx, int bsy){
|
|||||||
callret = lua_pcall(luacon_ci->l, 0, 0, 0);
|
callret = lua_pcall(luacon_ci->l, 0, 0, 0);
|
||||||
if (callret)
|
if (callret)
|
||||||
{
|
{
|
||||||
// failed, TODO: better error reporting
|
luacon_ci->Log(CommandInterface::LogError, luacon_geterror());
|
||||||
luacon_ci->Log(CommandInterface::LogError, luacon_geterror());//("%s\n",luacon_geterror());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user