Additional check in API

This commit is contained in:
Jean-Patrick Guerrero 2021-11-06 02:20:34 +01:00
parent 22bfbf1f56
commit 9afbee72ce
2 changed files with 3 additions and 1 deletions

View File

@ -1,6 +1,6 @@
# i3 # 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. #### **`i3`** is a next-generation inventory for Minetest.

View File

@ -302,6 +302,8 @@ function i3.add_sorting_method(def)
return err "i3.add_sorting_method: name missing" return err "i3.add_sorting_method: name missing"
elseif not is_func(def.func) then elseif not is_func(def.func) then
return err "i3.add_sorting_method: function missing" 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 end
insert(i3.sorting_methods, def) insert(i3.sorting_methods, def)