From 99e8f1808c63c11c6331ff41e5d1a8106cf58885 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Thu, 2 Feb 2012 14:11:54 +0000 Subject: tolua: modified the binding generator to accept AString as a std::string synonym, re-generated Bindings with these settings. Lua callbacks can now safely use AString functions in C++. git-svn-id: http://mc-server.googlecode.com/svn/trunk@225 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Bindings.cpp | 55 ++++++++++++++++++++++++++-------------------------- source/Bindings.h | 2 +- source/tolua++.exe | Bin 192000 -> 192000 bytes 3 files changed, 29 insertions(+), 28 deletions(-) (limited to 'source') diff --git a/source/Bindings.cpp b/source/Bindings.cpp index 0021b1d3b..14a25dc35 100644 --- a/source/Bindings.cpp +++ b/source/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 02/01/12 21:13:18. +** Generated automatically by tolua++-1.0.92 on 02/02/12 15:03:55. */ #ifndef __cplusplus @@ -164,56 +164,55 @@ static void tolua_reg_types (lua_State* tolua_S) tolua_usertype(tolua_S,"TakeDamageInfo"); tolua_usertype(tolua_S,"cPlugin"); tolua_usertype(tolua_S,"cStringMap"); - tolua_usertype(tolua_S,"cPluginManager"); - tolua_usertype(tolua_S,"Lua__cPacket_BlockDig"); + tolua_usertype(tolua_S,"Lua__cEntity"); tolua_usertype(tolua_S,"Json::Value"); tolua_usertype(tolua_S,"cInventory"); tolua_usertype(tolua_S,"cRoot"); - tolua_usertype(tolua_S,"cTCPLink"); + tolua_usertype(tolua_S,"Lua__cPacket_BlockDig"); tolua_usertype(tolua_S,"Lua__cTCPLink"); - tolua_usertype(tolua_S,"cTracer"); + tolua_usertype(tolua_S,"cWorld"); tolua_usertype(tolua_S,"cPlugin::CommandStruct"); tolua_usertype(tolua_S,"cPickup"); tolua_usertype(tolua_S,"cGroup"); tolua_usertype(tolua_S,"cPacket_Login"); tolua_usertype(tolua_S,"cClientHandle"); - tolua_usertype(tolua_S,"cMCLogger"); + tolua_usertype(tolua_S,"cTracer"); tolua_usertype(tolua_S,"cFurnaceRecipe"); - tolua_usertype(tolua_S,"cCuboid"); + tolua_usertype(tolua_S,"cMCLogger"); tolua_usertype(tolua_S,"cChatColor"); - tolua_usertype(tolua_S,"Vector3i"); + tolua_usertype(tolua_S,"cCuboid"); tolua_usertype(tolua_S,"cPacket_PickupSpawn"); tolua_usertype(tolua_S,"Lua__cWebPlugin"); tolua_usertype(tolua_S,"Lua__cPawn"); - tolua_usertype(tolua_S,"cPlugin_NewLua"); + tolua_usertype(tolua_S,"Vector3i"); tolua_usertype(tolua_S,"cItem"); tolua_usertype(tolua_S,"Vector3f"); tolua_usertype(tolua_S,"cPlugin_Lua"); tolua_usertype(tolua_S,"cWebPlugin_Lua"); - tolua_usertype(tolua_S,"Lua__cPlayer"); + tolua_usertype(tolua_S,"Lua__cPlugin_NewLua"); tolua_usertype(tolua_S,"cPacket"); tolua_usertype(tolua_S,"cPacket_BlockDig"); tolua_usertype(tolua_S,"cWebAdmin"); - tolua_usertype(tolua_S,"cRecipeChecker"); + tolua_usertype(tolua_S,"cTCPLink"); tolua_usertype(tolua_S,"cBlockEntity"); + tolua_usertype(tolua_S,"cRecipeChecker"); tolua_usertype(tolua_S,"cGroupManager"); - tolua_usertype(tolua_S,"Lua__cPickup"); tolua_usertype(tolua_S,"Lua__cPlugin"); - tolua_usertype(tolua_S,"Lua__cEntity"); + tolua_usertype(tolua_S,"Lua__cPickup"); tolua_usertype(tolua_S,"cPacket_BlockPlace"); tolua_usertype(tolua_S,"cLadder"); - tolua_usertype(tolua_S,"cWebPlugin"); - tolua_usertype(tolua_S,"AString"); + tolua_usertype(tolua_S,"cPluginManager"); + tolua_usertype(tolua_S,"Lua__cPlayer"); tolua_usertype(tolua_S,"cIniFile"); - tolua_usertype(tolua_S,"cEntity"); + tolua_usertype(tolua_S,"cWebPlugin"); tolua_usertype(tolua_S,"HTTPRequest"); tolua_usertype(tolua_S,"cPawn"); tolua_usertype(tolua_S,"cPlayer"); tolua_usertype(tolua_S,"cTorch"); + tolua_usertype(tolua_S,"cEntity"); + tolua_usertype(tolua_S,"cPlugin_NewLua"); tolua_usertype(tolua_S,"HTTPFormData"); tolua_usertype(tolua_S,"cServer"); - tolua_usertype(tolua_S,"cWorld"); - tolua_usertype(tolua_S,"Lua__cPlugin_NewLua"); tolua_usertype(tolua_S,"cStairs"); tolua_usertype(tolua_S,"Vector3d"); } @@ -2968,7 +2967,7 @@ static int tolua_AllToLua_cClientHandle_Kick00(lua_State* tolua_S) tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"cClientHandle",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const AString",0,&tolua_err)) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || !tolua_isnoobj(tolua_S,3,&tolua_err) ) goto tolua_lerror; @@ -2976,15 +2975,16 @@ static int tolua_AllToLua_cClientHandle_Kick00(lua_State* tolua_S) #endif { cClientHandle* self = (cClientHandle*) tolua_tousertype(tolua_S,1,0); - const AString* a_Reason = ((const AString*) tolua_tousertype(tolua_S,2,0)); + const AString a_Reason = ((const AString) tolua_tocppstring(tolua_S,2,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Kick'", NULL); #endif { - self->Kick(*a_Reason); + self->Kick(a_Reason); + tolua_pushcppstring(tolua_S,(const char*)a_Reason); } } - return 0; + return 1; #ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'Kick'.",&tolua_err); @@ -5457,8 +5457,8 @@ static int tolua_AllToLua_cPlayer_GetName00(lua_State* tolua_S) if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetName'", NULL); #endif { - const AString& tolua_ret = (const AString&) self->GetName(); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const AString"); + const AString tolua_ret = (const AString) self->GetName(); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); } } return 1; @@ -5478,7 +5478,7 @@ static int tolua_AllToLua_cPlayer_SetName00(lua_State* tolua_S) tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isstring(tolua_S,2,0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || !tolua_isnoobj(tolua_S,3,&tolua_err) ) goto tolua_lerror; @@ -5486,15 +5486,16 @@ static int tolua_AllToLua_cPlayer_SetName00(lua_State* tolua_S) #endif { cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - const char* a_Name = ((const char*) tolua_tostring(tolua_S,2,0)); + const AString a_Name = ((const AString) tolua_tocppstring(tolua_S,2,0)); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetName'", NULL); #endif { self->SetName(a_Name); + tolua_pushcppstring(tolua_S,(const char*)a_Name); } } - return 0; + return 1; #ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'SetName'.",&tolua_err); diff --git a/source/Bindings.h b/source/Bindings.h index 76a4e453d..3d3dc6f68 100644 --- a/source/Bindings.h +++ b/source/Bindings.h @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 02/01/12 21:13:19. +** Generated automatically by tolua++-1.0.92 on 02/02/12 15:03:55. */ /* Exported function */ diff --git a/source/tolua++.exe b/source/tolua++.exe index c39968dbf..8aab0dcb1 100644 Binary files a/source/tolua++.exe and b/source/tolua++.exe differ -- cgit v1.2.3