From 9afbee72ce3cd910d7788d8d12781276de3864e6 Mon Sep 17 00:00:00 2001 From: Jean-Patrick Guerrero Date: Sat, 6 Nov 2021 02:20:34 +0100 Subject: [PATCH] Additional check in API --- README.md | 2 +- src/api.lua | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 26f345d..6d0e87d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # i3 -[![ContentDB](https://content.minetest.net/packages/jp/i3/shields/title/)](https://content.minetest.net/packages/jp/i3/) [![ContentDB](https://content.minetest.net/packages/jp/i3/shields/downloads/)](https://content.minetest.net/packages/jp/i3/) ![workflow](https://github.com/minetest-mods/i3/actions/workflows/luacheck.yml/badge.svg) +[![ContentDB](https://content.minetest.net/packages/jp/i3/shields/downloads/)](https://content.minetest.net/packages/jp/i3/) ![workflow](https://github.com/minetest-mods/i3/actions/workflows/luacheck.yml/badge.svg) #### **`i3`** is a next-generation inventory for Minetest. diff --git a/src/api.lua b/src/api.lua index 47f242b..8e84077 100644 --- a/src/api.lua +++ b/src/api.lua @@ -302,6 +302,8 @@ function i3.add_sorting_method(def) return err "i3.add_sorting_method: name missing" elseif not is_func(def.func) then return err "i3.add_sorting_method: function missing" + elseif i3.compressed[def.name] then + return err(fmt("i3.add_sorting_method: item '%s' is already compressed", def.name)) end insert(i3.sorting_methods, def)