summaryrefslogtreecommitdiffstats
path: root/Server/Plugins/APIDump/APIDesc.lua
diff options
context:
space:
mode:
authorLane Kolbly <lane@rscheme.org>2017-06-27 15:14:30 +0200
committerLukas Pioch <lukas@zgow.de>2017-06-28 12:22:37 +0200
commit3f7bf88e30aa493c81795e0a1a79962ea081c030 (patch)
tree4951bb611a99120b96039d834c095397ba5644fc /Server/Plugins/APIDump/APIDesc.lua
parentcNetwork bindings: Use ApiParamError and CheckParam(Static)Self. (diff)
downloadcuberite-3f7bf88e30aa493c81795e0a1a79962ea081c030.tar
cuberite-3f7bf88e30aa493c81795e0a1a79962ea081c030.tar.gz
cuberite-3f7bf88e30aa493c81795e0a1a79962ea081c030.tar.bz2
cuberite-3f7bf88e30aa493c81795e0a1a79962ea081c030.tar.lz
cuberite-3f7bf88e30aa493c81795e0a1a79962ea081c030.tar.xz
cuberite-3f7bf88e30aa493c81795e0a1a79962ea081c030.tar.zst
cuberite-3f7bf88e30aa493c81795e0a1a79962ea081c030.zip
Diffstat (limited to '')
-rw-r--r--Server/Plugins/APIDump/APIDesc.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/Server/Plugins/APIDump/APIDesc.lua b/Server/Plugins/APIDump/APIDesc.lua
index 324c7503d..fb6dc44ec 100644
--- a/Server/Plugins/APIDump/APIDesc.lua
+++ b/Server/Plugins/APIDump/APIDesc.lua
@@ -7420,7 +7420,8 @@ This class represents a 2D array of items. It is used as the underlying storage
The following code tries to add 32 sticks to a player's main inventory:
<pre class="prettyprint lang-lua">
local Items = cItem(E_ITEM_STICK, 32);
-local PlayerMainInventory = Player:GetInventorySlots(); -- PlayerMainInventory is of type cItemGrid
+local PlayerInventory = Player:GetInventory();
+local PlayerMainInventory = PlayerInventory:GetInventoryGrid(); -- PlayerMainInventory is of type cItemGrid
local NumAdded = PlayerMainInventory:AddItem(Items);
if (NumAdded == Items.m_ItemCount) then
-- All the sticks did fit
@@ -7437,7 +7438,8 @@ end
Contents = [[
The following code damages the helmet in the player's armor and destroys it if it reaches max damage:
<pre class="prettyprint lang-lua">
-local PlayerArmor = Player:GetArmorSlots(); -- PlayerArmor is of type cItemGrid
+local PlayerInventory = Player:GetInventory();
+local PlayerArmor = PlayerInventory:GetArmorGrid(); -- PlayerArmor is of type cItemGrid
if (PlayerArmor:DamageItem(0)) then -- Helmet is at SlotNum 0
-- The helmet has reached max damage, destroy it:
PlayerArmor:EmptySlot(0);