summaryrefslogtreecommitdiff
path: root/src/script/lua_api
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/lua_api')
-rw-r--r--src/script/lua_api/l_inventory.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/script/lua_api/l_inventory.cpp b/src/script/lua_api/l_inventory.cpp
index 110e68d23..38eade609 100644
--- a/src/script/lua_api/l_inventory.cpp
+++ b/src/script/lua_api/l_inventory.cpp
@@ -520,16 +520,17 @@ int ModApiInventory::l_get_inventory(lua_State *L)
}
}
-// create_detached_inventory_raw(name)
+// create_detached_inventory_raw(name, [player_name])
int ModApiInventory::l_create_detached_inventory_raw(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
const char *name = luaL_checkstring(L, 1);
- if(getServer(L)->createDetachedInventory(name) != NULL){
+ const char *player = lua_isstring(L, 2) ? lua_tostring(L, 2) : "";
+ if (getServer(L)->createDetachedInventory(name, player) != NULL) {
InventoryLocation loc;
loc.setDetached(name);
InvRef::create(L, loc);
- }else{
+ } else {
lua_pushnil(L);
}
return 1;