1
0
Fork 0

Added cItems to Lua API.

Now HOOK_BLOCK_TO_PICKUPS is fully functional, as demonstrated by HookNotify.

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1178 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2013-01-27 03:45:40 +00:00
parent df0190afd7
commit 67048ee057
8 changed files with 321 additions and 348 deletions

View File

@ -74,9 +74,17 @@ end
function OnBlockToPickups(...)
LOG("************************");
LogHook("OnBlockToPickups", unpack(arg));
LOG("========================");
local World, Digger, BlockX, BlockY, BlockZ, BlockType, BlockMeta, Pickups = unpack(arg);
if (Pickups ~= nil) then
local Name = "NULL";
if (Digger ~= nil) then
Name = Digger:GetName()
end
LOG("Got cItems from " .. Name .. ", trying to manipulate them.");
Pickups:Add(cItem:new(E_ITEM_DIAMOND_SHOVEL, 1));
LOG("Current size: " .. Pickups:Size());
end;
end;

View File

@ -1467,10 +1467,6 @@
RelativePath="..\source\LuaFunctions.h"
>
</File>
<File
RelativePath="..\source\LuaItems.h"
>
</File>
<File
RelativePath="..\source\ManualBindings.cpp"
>

View File

@ -54,4 +54,3 @@ $cfile "Group.h"
$cfile "BlockArea.h"
$cfile "Generating/ChunkDesc.h"
$cfile "CraftingRecipes.h"
$cfile "LuaItems.h"

View File

@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
** Generated automatically by tolua++-1.0.92 on 01/27/13 05:59:07.
** Generated automatically by tolua++-1.0.92 on 01/27/13 07:29:49.
*/
#ifndef __cplusplus
@ -53,7 +53,6 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S);
#include "BlockArea.h"
#include "Generating/ChunkDesc.h"
#include "CraftingRecipes.h"
#include "LuaItems.h"
/* function to release collected object via destructor */
#ifdef __cplusplus
@ -155,7 +154,6 @@ static void tolua_reg_types (lua_State* tolua_S)
tolua_usertype(tolua_S,"cInventory");
tolua_usertype(tolua_S,"cRoot");
tolua_usertype(tolua_S,"cCraftingGrid");
tolua_usertype(tolua_S,"cLuaItems");
tolua_usertype(tolua_S,"cPlugin::CommandStruct");
tolua_usertype(tolua_S,"cPickup");
tolua_usertype(tolua_S,"cItems");
@ -169,7 +167,7 @@ static void tolua_reg_types (lua_State* tolua_S)
tolua_usertype(tolua_S,"Vector3i");
tolua_usertype(tolua_S,"Lua__cWebPlugin");
tolua_usertype(tolua_S,"Lua__cPawn");
tolua_usertype(tolua_S,"cPawn");
tolua_usertype(tolua_S,"cStairs");
tolua_usertype(tolua_S,"cItem");
tolua_usertype(tolua_S,"Vector3f");
tolua_usertype(tolua_S,"Lua__cTCPLink");
@ -181,13 +179,13 @@ static void tolua_reg_types (lua_State* tolua_S)
tolua_usertype(tolua_S,"cGroupManager");
tolua_usertype(tolua_S,"cBlockEntity");
tolua_usertype(tolua_S,"Lua__cPickup");
tolua_usertype(tolua_S,"Lua__cEntity");
tolua_usertype(tolua_S,"cPluginManager");
tolua_usertype(tolua_S,"cWebPlugin");
tolua_usertype(tolua_S,"cPluginManager");
tolua_usertype(tolua_S,"cPlugin");
tolua_usertype(tolua_S,"HTTPFormData");
tolua_usertype(tolua_S,"cLadder");
tolua_usertype(tolua_S,"MTRand");
tolua_usertype(tolua_S,"HTTPFormData");
tolua_usertype(tolua_S,"cWorld");
tolua_usertype(tolua_S,"cIniFile");
tolua_usertype(tolua_S,"cEntity");
tolua_usertype(tolua_S,"HTTPRequest");
@ -197,8 +195,8 @@ static void tolua_reg_types (lua_State* tolua_S)
tolua_usertype(tolua_S,"cBlockEntityWindowOwner");
tolua_usertype(tolua_S,"cServer");
tolua_usertype(tolua_S,"Lua__cChestEntity");
tolua_usertype(tolua_S,"cWorld");
tolua_usertype(tolua_S,"cStairs");
tolua_usertype(tolua_S,"cPawn");
tolua_usertype(tolua_S,"Lua__cEntity");
tolua_usertype(tolua_S,"Vector3d");
}
@ -12495,6 +12493,270 @@ static int tolua_set_cItem_m_ItemDamage(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
/* method: Get of class cItems */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_Get00
static int tolua_AllToLua_cItems_Get00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cItems",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0);
int a_Idx = ((int) tolua_tonumber(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Get'", NULL);
#endif
{
cItem& tolua_ret = (cItem&) self->Get(a_Idx);
tolua_pushusertype(tolua_S,(void*)&tolua_ret,"cItem");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'Get'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: Set of class cItems */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_Set00
static int tolua_AllToLua_cItems_Set00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cItems",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
(tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const cItem",0,&tolua_err)) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0);
int a_Idx = ((int) tolua_tonumber(tolua_S,2,0));
const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,3,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Set'", NULL);
#endif
{
self->Set(a_Idx,*a_Item);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'Set'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: Add of class cItems */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_Add00
static int tolua_AllToLua_cItems_Add00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cItems",0,&tolua_err) ||
(tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0);
const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Add'", NULL);
#endif
{
self->Add(*a_Item);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'Add'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: Delete of class cItems */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_Delete00
static int tolua_AllToLua_cItems_Delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cItems",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0);
int a_Idx = ((int) tolua_tonumber(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Delete'", NULL);
#endif
{
self->Delete(a_Idx);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'Delete'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: Clear of class cItems */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_Clear00
static int tolua_AllToLua_cItems_Clear00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cItems",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Clear'", NULL);
#endif
{
self->Clear();
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'Clear'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: Size of class cItems */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_Size00
static int tolua_AllToLua_cItems_Size00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cItems",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Size'", NULL);
#endif
{
int tolua_ret = (int) self->Size();
tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'Size'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: Add of class cItems */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_Add01
static int tolua_AllToLua_cItems_Add01(lua_State* tolua_S)
{
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cItems",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnumber(tolua_S,3,0,&tolua_err) ||
!tolua_isnumber(tolua_S,4,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,5,&tolua_err)
)
goto tolua_lerror;
else
{
cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0);
ENUM_ITEM_ID a_ItemType = ((ENUM_ITEM_ID) (int) tolua_tonumber(tolua_S,2,0));
char a_ItemCount = ((char) tolua_tonumber(tolua_S,3,0));
short a_ItemHealth = ((short) tolua_tonumber(tolua_S,4,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Add'", NULL);
#endif
{
self->Add(a_ItemType,a_ItemCount,a_ItemHealth);
}
}
return 0;
tolua_lerror:
return tolua_AllToLua_cItems_Add00(tolua_S);
}
#endif //#ifndef TOLUA_DISABLE
/* method: Set of class cItems */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_Set01
static int tolua_AllToLua_cItems_Set01(lua_State* tolua_S)
{
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cItems",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnumber(tolua_S,3,0,&tolua_err) ||
!tolua_isnumber(tolua_S,4,0,&tolua_err) ||
!tolua_isnumber(tolua_S,5,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,6,&tolua_err)
)
goto tolua_lerror;
else
{
cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0);
int a_Idx = ((int) tolua_tonumber(tolua_S,2,0));
ENUM_ITEM_ID a_ItemType = ((ENUM_ITEM_ID) (int) tolua_tonumber(tolua_S,3,0));
char a_ItemCount = ((char) tolua_tonumber(tolua_S,4,0));
short a_ItemHealth = ((short) tolua_tonumber(tolua_S,5,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Set'", NULL);
#endif
{
self->Set(a_Idx,a_ItemType,a_ItemCount,a_ItemHealth);
}
}
return 0;
tolua_lerror:
return tolua_AllToLua_cItems_Set00(tolua_S);
}
#endif //#ifndef TOLUA_DISABLE
/* method: GetSlot of class cChestEntity */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cChestEntity_GetSlot00
static int tolua_AllToLua_cChestEntity_GetSlot00(lua_State* tolua_S)
@ -19977,270 +20239,6 @@ static int tolua_AllToLua_cCraftingRecipe_Dump00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
/* method: Get of class cLuaItems */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaItems_Get00
static int tolua_AllToLua_cLuaItems_Get00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cLuaItems",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
cLuaItems* self = (cLuaItems*) tolua_tousertype(tolua_S,1,0);
int a_Idx = ((int) tolua_tonumber(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Get'", NULL);
#endif
{
cItem& tolua_ret = (cItem&) self->Get(a_Idx);
tolua_pushusertype(tolua_S,(void*)&tolua_ret,"cItem");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'Get'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: Set of class cLuaItems */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaItems_Set00
static int tolua_AllToLua_cLuaItems_Set00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cLuaItems",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
(tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const cItem",0,&tolua_err)) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
cLuaItems* self = (cLuaItems*) tolua_tousertype(tolua_S,1,0);
int a_Idx = ((int) tolua_tonumber(tolua_S,2,0));
const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,3,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Set'", NULL);
#endif
{
self->Set(a_Idx,*a_Item);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'Set'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: Add of class cLuaItems */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaItems_Add00
static int tolua_AllToLua_cLuaItems_Add00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cLuaItems",0,&tolua_err) ||
(tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
cLuaItems* self = (cLuaItems*) tolua_tousertype(tolua_S,1,0);
const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Add'", NULL);
#endif
{
self->Add(*a_Item);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'Add'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: Delete of class cLuaItems */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaItems_Delete00
static int tolua_AllToLua_cLuaItems_Delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cLuaItems",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
cLuaItems* self = (cLuaItems*) tolua_tousertype(tolua_S,1,0);
int a_Idx = ((int) tolua_tonumber(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Delete'", NULL);
#endif
{
self->Delete(a_Idx);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'Delete'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: Clear of class cLuaItems */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaItems_Clear00
static int tolua_AllToLua_cLuaItems_Clear00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cLuaItems",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
cLuaItems* self = (cLuaItems*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Clear'", NULL);
#endif
{
self->Clear();
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'Clear'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: Size of class cLuaItems */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaItems_Size00
static int tolua_AllToLua_cLuaItems_Size00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cLuaItems",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
cLuaItems* self = (cLuaItems*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Size'", NULL);
#endif
{
int tolua_ret = (int) self->Size();
tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'Size'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: Add of class cLuaItems */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaItems_Add01
static int tolua_AllToLua_cLuaItems_Add01(lua_State* tolua_S)
{
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cLuaItems",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnumber(tolua_S,3,0,&tolua_err) ||
!tolua_isnumber(tolua_S,4,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,5,&tolua_err)
)
goto tolua_lerror;
else
{
cLuaItems* self = (cLuaItems*) tolua_tousertype(tolua_S,1,0);
ENUM_ITEM_ID a_ItemType = ((ENUM_ITEM_ID) (int) tolua_tonumber(tolua_S,2,0));
char a_ItemCount = ((char) tolua_tonumber(tolua_S,3,0));
short a_ItemHealth = ((short) tolua_tonumber(tolua_S,4,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Add'", NULL);
#endif
{
self->Add(a_ItemType,a_ItemCount,a_ItemHealth);
}
}
return 0;
tolua_lerror:
return tolua_AllToLua_cLuaItems_Add00(tolua_S);
}
#endif //#ifndef TOLUA_DISABLE
/* method: Set of class cLuaItems */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaItems_Set01
static int tolua_AllToLua_cLuaItems_Set01(lua_State* tolua_S)
{
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cLuaItems",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnumber(tolua_S,3,0,&tolua_err) ||
!tolua_isnumber(tolua_S,4,0,&tolua_err) ||
!tolua_isnumber(tolua_S,5,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,6,&tolua_err)
)
goto tolua_lerror;
else
{
cLuaItems* self = (cLuaItems*) tolua_tousertype(tolua_S,1,0);
int a_Idx = ((int) tolua_tonumber(tolua_S,2,0));
ENUM_ITEM_ID a_ItemType = ((ENUM_ITEM_ID) (int) tolua_tonumber(tolua_S,3,0));
char a_ItemCount = ((char) tolua_tonumber(tolua_S,4,0));
short a_ItemHealth = ((short) tolua_tonumber(tolua_S,5,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Set'", NULL);
#endif
{
self->Set(a_Idx,a_ItemType,a_ItemCount,a_ItemHealth);
}
}
return 0;
tolua_lerror:
return tolua_AllToLua_cLuaItems_Set00(tolua_S);
}
#endif //#ifndef TOLUA_DISABLE
/* Open function */
TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
{
@ -21423,6 +21421,17 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_variable(tolua_S,"m_ItemCount",tolua_get_cItem_m_ItemCount,tolua_set_cItem_m_ItemCount);
tolua_variable(tolua_S,"m_ItemDamage",tolua_get_cItem_m_ItemDamage,tolua_set_cItem_m_ItemDamage);
tolua_endmodule(tolua_S);
tolua_cclass(tolua_S,"cItems","cItems","",NULL);
tolua_beginmodule(tolua_S,"cItems");
tolua_function(tolua_S,"Get",tolua_AllToLua_cItems_Get00);
tolua_function(tolua_S,"Set",tolua_AllToLua_cItems_Set00);
tolua_function(tolua_S,"Add",tolua_AllToLua_cItems_Add00);
tolua_function(tolua_S,"Delete",tolua_AllToLua_cItems_Delete00);
tolua_function(tolua_S,"Clear",tolua_AllToLua_cItems_Clear00);
tolua_function(tolua_S,"Size",tolua_AllToLua_cItems_Size00);
tolua_function(tolua_S,"Add",tolua_AllToLua_cItems_Add01);
tolua_function(tolua_S,"Set",tolua_AllToLua_cItems_Set01);
tolua_endmodule(tolua_S);
tolua_cclass(tolua_S,"cChestEntity","cChestEntity","cBlockEntity",NULL);
tolua_beginmodule(tolua_S,"cChestEntity");
tolua_function(tolua_S,"GetSlot",tolua_AllToLua_cChestEntity_GetSlot00);
@ -21776,17 +21785,6 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"ConsumeIngredients",tolua_AllToLua_cCraftingRecipe_ConsumeIngredients00);
tolua_function(tolua_S,"Dump",tolua_AllToLua_cCraftingRecipe_Dump00);
tolua_endmodule(tolua_S);
tolua_cclass(tolua_S,"cLuaItems","cLuaItems","",NULL);
tolua_beginmodule(tolua_S,"cLuaItems");
tolua_function(tolua_S,"Get",tolua_AllToLua_cLuaItems_Get00);
tolua_function(tolua_S,"Set",tolua_AllToLua_cLuaItems_Set00);
tolua_function(tolua_S,"Add",tolua_AllToLua_cLuaItems_Add00);
tolua_function(tolua_S,"Delete",tolua_AllToLua_cLuaItems_Delete00);
tolua_function(tolua_S,"Clear",tolua_AllToLua_cLuaItems_Clear00);
tolua_function(tolua_S,"Size",tolua_AllToLua_cLuaItems_Size00);
tolua_function(tolua_S,"Add",tolua_AllToLua_cLuaItems_Add01);
tolua_function(tolua_S,"Set",tolua_AllToLua_cLuaItems_Set01);
tolua_endmodule(tolua_S);
tolua_endmodule(tolua_S);
return 1;
}

View File

@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
** Generated automatically by tolua++-1.0.92 on 01/27/13 05:59:07.
** Generated automatically by tolua++-1.0.92 on 01/27/13 07:29:49.
*/
/* Exported function */

View File

@ -120,7 +120,34 @@ public:
};
// tolua_end
typedef std::vector<cItem> cItems;
// This stupid construct is here only so that Lua can access cItems in an API
class cItems // tolua_export
: public std::vector<cItem>
{ // tolua_export
public:
// tolua_begin
cItem & Get (int a_Idx) {return at(a_Idx); }
void Set (int a_Idx, const cItem & a_Item) {at(a_Idx) = a_Item; }
void Add (const cItem & a_Item) {push_back(a_Item); }
void Delete(int a_Idx) {erase(begin() + a_Idx); }
void Clear (void) {clear(); }
int Size (void) {return size(); }
void Add (ENUM_ITEM_ID a_ItemType, char a_ItemCount, short a_ItemHealth)
{
push_back(cItem(a_ItemType, a_ItemCount, a_ItemHealth));
}
void Set (int a_Idx, ENUM_ITEM_ID a_ItemType, char a_ItemCount, short a_ItemHealth)
{
at(a_Idx) = cItem(a_ItemType, a_ItemCount, a_ItemHealth);
}
// tolua_end
} ; // tolua_export

View File

@ -1,54 +0,0 @@
// LuaItems.h
// Interfaces to the cLuaItems class representing a wrapper class that allows Lua to access and manipulate cItems
#pragma once
#include "Item.h"
// tolua_begin
class cLuaItems
{
public:
// tolua_end
// The constructor is not to be Lua-exported, Lua cannot make use of this object
cLuaItems(cItems & a_Items) :
m_Items(a_Items)
{
}
// tolua_begin
cItem & Get (int a_Idx) {return m_Items[a_Idx]; }
void Set (int a_Idx, const cItem & a_Item) {m_Items[a_Idx] = a_Item; }
void Add (const cItem & a_Item) {m_Items.push_back(a_Item); }
void Delete(int a_Idx) {m_Items.erase(m_Items.begin() + a_Idx); }
void Clear (void) {m_Items.clear(); }
int Size (void) {return m_Items.size(); }
void Add (ENUM_ITEM_ID a_ItemType, char a_ItemCount, short a_ItemHealth)
{
m_Items.push_back(cItem(a_ItemType, a_ItemCount, a_ItemHealth));
}
void Set (int a_Idx, ENUM_ITEM_ID a_ItemType, char a_ItemCount, short a_ItemHealth)
{
m_Items[a_Idx] = cItem(a_ItemType, a_ItemCount, a_ItemHealth);
}
protected:
cItems & m_Items;
} ;
// tolua_end

View File

@ -4,7 +4,6 @@
#define LUA_USE_POSIX
#include "Plugin_NewLua.h"
#include "MCLogger.h"
#include "LuaItems.h"
extern "C"
{