summaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_inventory.cpp
diff options
context:
space:
mode:
authorred-001 <red-001@outlook.ie>2017-01-31 13:18:52 +0000
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-03-13 23:56:05 +0100
commit88df9fb5b6c78df9485e8bf3750e2608bd78e14c (patch)
treed823267e244592a7603dc3baffff49818765a853 /src/script/lua_api/l_inventory.cpp
parent44ca9c9cb2079fa97068adb8ee894c5ae13a9975 (diff)
downloadminetest-88df9fb5b6c78df9485e8bf3750e2608bd78e14c.tar.gz
minetest-88df9fb5b6c78df9485e8bf3750e2608bd78e14c.tar.bz2
minetest-88df9fb5b6c78df9485e8bf3750e2608bd78e14c.zip
Add `get_wielded_item`
Diffstat (limited to 'src/script/lua_api/l_inventory.cpp')
-rw-r--r--src/script/lua_api/l_inventory.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/script/lua_api/l_inventory.cpp b/src/script/lua_api/l_inventory.cpp
index 38eade609..9a4aa845d 100644
--- a/src/script/lua_api/l_inventory.cpp
+++ b/src/script/lua_api/l_inventory.cpp
@@ -194,7 +194,7 @@ int InvRef::l_set_stack(lua_State *L)
InvRef *ref = checkobject(L, 1);
const char *listname = luaL_checkstring(L, 2);
int i = luaL_checknumber(L, 3) - 1;
- ItemStack newitem = read_item(L, 4, getServer(L));
+ ItemStack newitem = read_item(L, 4, getServer(L)->idef());
InventoryList *list = getlist(L, ref, listname);
if(list != NULL && i >= 0 && i < (int) list->getSize()){
list->changeItem(i, newitem);
@@ -295,7 +295,7 @@ int InvRef::l_add_item(lua_State *L)
NO_MAP_LOCK_REQUIRED;
InvRef *ref = checkobject(L, 1);
const char *listname = luaL_checkstring(L, 2);
- ItemStack item = read_item(L, 3, getServer(L));
+ ItemStack item = read_item(L, 3, getServer(L)->idef());
InventoryList *list = getlist(L, ref, listname);
if(list){
ItemStack leftover = list->addItem(item);
@@ -315,7 +315,7 @@ int InvRef::l_room_for_item(lua_State *L)
NO_MAP_LOCK_REQUIRED;
InvRef *ref = checkobject(L, 1);
const char *listname = luaL_checkstring(L, 2);
- ItemStack item = read_item(L, 3, getServer(L));
+ ItemStack item = read_item(L, 3, getServer(L)->idef());
InventoryList *list = getlist(L, ref, listname);
if(list){
lua_pushboolean(L, list->roomForItem(item));
@@ -332,7 +332,7 @@ int InvRef::l_contains_item(lua_State *L)
NO_MAP_LOCK_REQUIRED;
InvRef *ref = checkobject(L, 1);
const char *listname = luaL_checkstring(L, 2);
- ItemStack item = read_item(L, 3, getServer(L));
+ ItemStack item = read_item(L, 3, getServer(L)->idef());
InventoryList *list = getlist(L, ref, listname);
if(list){
lua_pushboolean(L, list->containsItem(item));
@@ -349,7 +349,7 @@ int InvRef::l_remove_item(lua_State *L)
NO_MAP_LOCK_REQUIRED;
InvRef *ref = checkobject(L, 1);
const char *listname = luaL_checkstring(L, 2);
- ItemStack item = read_item(L, 3, getServer(L));
+ ItemStack item = read_item(L, 3, getServer(L)->idef());
InventoryList *list = getlist(L, ref, listname);
if(list){
ItemStack removed = list->removeItem(item);