summaryrefslogtreecommitdiffstats
path: root/source/cWebPlugin_Lua.cpp
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-01-30 17:47:26 +0100
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-01-30 17:47:26 +0100
commit9dfa0f1f15c413540e932a04e94419a8a3b37dcf (patch)
treec111ee0ad961aa365b2c681e486dae4ce7e09421 /source/cWebPlugin_Lua.cpp
parentMore cFile cleanup; removed old format writing for block entities (diff)
downloadcuberite-9dfa0f1f15c413540e932a04e94419a8a3b37dcf.tar
cuberite-9dfa0f1f15c413540e932a04e94419a8a3b37dcf.tar.gz
cuberite-9dfa0f1f15c413540e932a04e94419a8a3b37dcf.tar.bz2
cuberite-9dfa0f1f15c413540e932a04e94419a8a3b37dcf.tar.lz
cuberite-9dfa0f1f15c413540e932a04e94419a8a3b37dcf.tar.xz
cuberite-9dfa0f1f15c413540e932a04e94419a8a3b37dcf.tar.zst
cuberite-9dfa0f1f15c413540e932a04e94419a8a3b37dcf.zip
Diffstat (limited to 'source/cWebPlugin_Lua.cpp')
-rw-r--r--source/cWebPlugin_Lua.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/source/cWebPlugin_Lua.cpp b/source/cWebPlugin_Lua.cpp
index f92cb1690..40e8fcb76 100644
--- a/source/cWebPlugin_Lua.cpp
+++ b/source/cWebPlugin_Lua.cpp
@@ -84,18 +84,21 @@ std::string cWebPlugin_Lua::HandleRequest( HTTPRequest* a_Request )
tolua_pushusertype( LuaState, a_Request, "HTTPRequest" );
LOGINFO("Calling bound function! :D");
int s = lua_pcall( LuaState, 1, 1, 0);
- if( report_errors( LuaState, s ) )
+
+ if ( s != 0 )
{
+ std::string err = lua_tostring(LuaState, -1);
+ LOGERROR("-- %s", err.c_str() );
+ lua_pop(LuaState, 1);
LOGINFO("error. Stack size: %i", lua_gettop(LuaState) );
- return false;
+ return err; // Show the error message in the web page, looks cool
}
-
if( !lua_isstring( LuaState, -1 ) )
{
LOGWARN("WARNING: WebPlugin tab '%s' did not return a string!", Tab->Title.c_str() );
lua_pop(LuaState, 1); // Pop return value
- return "";
+ return std::string("WARNING: WebPlugin tab '") + Tab->Title + std::string("' did not return a string!");
}
RetVal += tolua_tostring(LuaState, -1, 0);