diff options
author | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-01-28 00:47:32 +0100 |
---|---|---|
committer | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-01-28 00:47:32 +0100 |
commit | de293999872346271cdfb5dbecbad7f77362b83b (patch) | |
tree | c627283aacda09be1592f85805261fec782b8a6d /source/ManualBindings.cpp | |
parent | Added a VC2010 configuration for Debug build with optimized Noise; made it the default in VC2008 (diff) | |
download | cuberite-de293999872346271cdfb5dbecbad7f77362b83b.tar cuberite-de293999872346271cdfb5dbecbad7f77362b83b.tar.gz cuberite-de293999872346271cdfb5dbecbad7f77362b83b.tar.bz2 cuberite-de293999872346271cdfb5dbecbad7f77362b83b.tar.lz cuberite-de293999872346271cdfb5dbecbad7f77362b83b.tar.xz cuberite-de293999872346271cdfb5dbecbad7f77362b83b.tar.zst cuberite-de293999872346271cdfb5dbecbad7f77362b83b.zip |
Diffstat (limited to '')
-rw-r--r-- | source/ManualBindings.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/source/ManualBindings.cpp b/source/ManualBindings.cpp index 728320f11..a40bcb9d6 100644 --- a/source/ManualBindings.cpp +++ b/source/ManualBindings.cpp @@ -6,6 +6,7 @@ #include "cWorld.h"
#include "cPlugin.h"
#include "cPluginManager.h"
+#include "cWebPlugin_Lua.h"
#include "cLuaCommandBinder.h"
#include "cPlayer.h"
#include "md5/md5.h"
@@ -191,6 +192,49 @@ static int tolua_cPlugin_BindCommand(lua_State* tolua_S) return 0;
}
+static int tolua_cWebPlugin_Lua_AddTab(lua_State* tolua_S)
+{
+ cWebPlugin_Lua* self = (cWebPlugin_Lua*) tolua_tousertype(tolua_S,1,0);
+
+ tolua_Error tolua_err;
+ tolua_err.array = 0;
+ tolua_err.index = 0;
+ tolua_err.type = 0;
+
+ std::string Title = "";
+ int Reference = LUA_REFNIL;
+
+ if( tolua_isstring( tolua_S, 2, 0, &tolua_err ) &&
+ lua_isfunction( tolua_S, 3 ) )
+ {
+ Reference = luaL_ref(tolua_S, LUA_REGISTRYINDEX);
+ Title = ((std::string) tolua_tocppstring(tolua_S,2,0));
+ }
+ else
+ {
+ if( tolua_err.type == 0 )
+ {
+ tolua_err.type = "function";
+ }
+ tolua_error(tolua_S,"#ferror in function 'AddTab'.",&tolua_err);
+ return 0;
+ }
+
+ if( Reference != LUA_REFNIL )
+ {
+ if( !self->AddTab( 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() );
+ }
+
+ return 0;
+}
+
static int tolua_md5(lua_State* tolua_S)
{
std::string SourceString = tolua_tostring(tolua_S, 1, 0);
@@ -222,6 +266,9 @@ void ManualBindings::Bind( lua_State* tolua_S ) tolua_beginmodule(tolua_S,"cPlayer");
tolua_function(tolua_S,"GetGroups",tolua_cPlayer_GetGroups);
tolua_endmodule(tolua_S);
+ tolua_beginmodule(tolua_S,"cWebPlugin_Lua");
+ tolua_function(tolua_S,"AddTab",tolua_cWebPlugin_Lua_AddTab);
+ tolua_endmodule(tolua_S);
tolua_function(tolua_S,"md5",tolua_md5);
|