]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/script/lua_api/l_inventory.cpp
Script API: Check that SAOs are still usable before attempting to use them
[dragonfireclient.git] / src / script / lua_api / l_inventory.cpp
index 04fa3a196bc391fc1d9e8d9ae06c2462a570dbf4..6e7afa4a4e67bf67575341f79af1ee72b1397d6e 100644 (file)
@@ -536,8 +536,18 @@ int ModApiInventory::l_create_detached_inventory_raw(lua_State *L)
        return 1;
 }
 
+// remove_detached_inventory_raw(name)
+int ModApiInventory::l_remove_detached_inventory_raw(lua_State *L)
+{
+       NO_MAP_LOCK_REQUIRED;
+       const std::string &name = luaL_checkstring(L, 1);
+       lua_pushboolean(L, getServer(L)->removeDetachedInventory(name));
+       return 1;
+}
+
 void ModApiInventory::Initialize(lua_State *L, int top)
 {
        API_FCT(create_detached_inventory_raw);
+       API_FCT(remove_detached_inventory_raw);
        API_FCT(get_inventory);
 }