From e48ccd79430db7c9e25209fdff51f8f36e20f202 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Tue, 6 Dec 2011 18:59:52 +0200 Subject: Add ObjectRef:get_inventory() and add stuff to documentation comments --- src/scriptapi.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/scriptapi.cpp b/src/scriptapi.cpp index c6a44c914..4dcb66c77 100644 --- a/src/scriptapi.cpp +++ b/src/scriptapi.cpp @@ -2005,9 +2005,21 @@ private: return 1; } - // inventory_set_list(self, name, {item1, item2, ...}) + // get_inventory(self) + static int l_get_inventory(lua_State *L) + { + ObjectRef *ref = checkobject(L, 1); + ServerRemotePlayer *player = getplayer(ref); + if(player == NULL) return 0; + // Do it + InvRef::createPlayer(L, player); + return 1; + } + + // deprecated: inventory_set_list(self, name, {item1, item2, ...}) static int l_inventory_set_list(lua_State *L) { + infostream<<"Deprecated: inventory_set_list"<