Check for item name type when registering new craft sorter
This commit is contained in:
parent
2e991c8ca8
commit
73eb08a078
5
api.lua
5
api.lua
|
@ -330,7 +330,10 @@ function ui.register_craft_sorter(method, item_name)
|
||||||
if type(method) ~= "function" then
|
if type(method) ~= "function" then
|
||||||
error(("Craft sorter method must be a function, %s given."):format(type(method)))
|
error(("Craft sorter method must be a function, %s given."):format(type(method)))
|
||||||
end
|
end
|
||||||
if not item_name then item_name = "_default_" end
|
if not (item_name == nil or type(item_name) == "string") then
|
||||||
|
error(("Craft sorter item name must be a string, %s given."):format(type(item_name)))
|
||||||
|
end
|
||||||
|
if item_name == nil then item_name = "_default_" end
|
||||||
ui.craft_sorters[item_name] = method
|
ui.craft_sorters[item_name] = method
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue