From 7c84349990f21f783f4b24c113fb372a3c00164b Mon Sep 17 00:00:00 2001 From: faketruth Date: Wed, 22 Aug 2012 14:22:21 +0000 Subject: WebAdmin should not cause crashes anymore Got rid of cWebPlugin_Lua cPlugin_Lua is also a cWebPlugin now, so plugins don't need a separate cWebPlugin object Changed some stuff to use AString instead of char* git-svn-id: http://mc-server.googlecode.com/svn/trunk@777 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/ManualBindings.cpp | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'source/ManualBindings.cpp') diff --git a/source/ManualBindings.cpp b/source/ManualBindings.cpp index 722e71a54..10109c669 100644 --- a/source/ManualBindings.cpp +++ b/source/ManualBindings.cpp @@ -7,8 +7,8 @@ #include "cRoot.h" #include "cWorld.h" #include "cPlugin.h" +#include "cPlugin_NewLua.h" #include "cPluginManager.h" -#include "cWebPlugin_Lua.h" #include "cLuaCommandBinder.h" #include "cPlayer.h" #include "cWebAdmin.h" @@ -549,9 +549,9 @@ static int tolua_cPlugin_BindCommand(lua_State* tolua_S) -static int tolua_cWebPlugin_Lua_AddTab(lua_State* tolua_S) +static int tolua_cPlugin_NewLua_AddWebTab(lua_State* tolua_S) { - cWebPlugin_Lua* self = (cWebPlugin_Lua*) tolua_tousertype(tolua_S,1,0); + cPlugin_NewLua* self = (cPlugin_NewLua*) tolua_tousertype(tolua_S,1,0); tolua_Error tolua_err; tolua_err.array = 0; @@ -573,20 +573,20 @@ static int tolua_cWebPlugin_Lua_AddTab(lua_State* tolua_S) { tolua_err.type = "function"; } - tolua_error(tolua_S,"#ferror in function 'AddTab'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'AddWebTab'.",&tolua_err); return 0; } if( Reference != LUA_REFNIL ) { - if( !self->AddTab( Title.c_str(), tolua_S, Reference ) ) + if( !self->AddWebTab( Title.c_str(), tolua_S, Reference ) ) { luaL_unref( tolua_S, LUA_REGISTRYINDEX, Reference ); } } else { - LOGERROR("ERROR: cWebPlugin_Lua:AddTab invalid function reference in 2nd argument (Title: \"%s\")", Title.c_str() ); + LOGERROR("ERROR: cPlugin_NewLua:AddWebTab invalid function reference in 2nd argument (Title: \"%s\")", Title.c_str() ); } return 0; @@ -596,6 +596,16 @@ static int tolua_cWebPlugin_Lua_AddTab(lua_State* tolua_S) +static int tolua_cPlugin_NewLua_AddTab(lua_State* tolua_S) +{ + LOGWARN("WARNING: Using deprecated function AddTab()! Use AddWebTab() instead."); + return tolua_cPlugin_NewLua_AddWebTab( tolua_S ); +} + + + + + static int tolua_md5(lua_State* tolua_S) { std::string SourceString = tolua_tostring(tolua_S, 1, 0); @@ -709,8 +719,9 @@ void ManualBindings::Bind( lua_State* tolua_S ) tolua_function(tolua_S, "GetResolvedPermissions", tolua_cPlayer_GetResolvedPermissions); tolua_endmodule(tolua_S); - tolua_beginmodule(tolua_S, "cWebPlugin_Lua"); - tolua_function(tolua_S, "AddTab", tolua_cWebPlugin_Lua_AddTab); + tolua_beginmodule(tolua_S, "cPlugin_NewLua"); + tolua_function(tolua_S, "AddWebTab", tolua_cPlugin_NewLua_AddWebTab); + tolua_function(tolua_S, "AddTab", tolua_cPlugin_NewLua_AddTab); tolua_endmodule(tolua_S); tolua_cclass(tolua_S,"HTTPRequest","HTTPRequest","",NULL); -- cgit v1.2.3