mirror of
https://github.com/minetest/minetest.git
synced 2025-01-24 06:51:35 +01:00
Trivial improvement to get_item_group
(#15260)
One hash table lookup is enough, and this is even easier for the JIT to inline, optimize, etc.
This commit is contained in:
parent
7435ea0d4e
commit
6431ef7324
@ -25,11 +25,8 @@ end
|
|||||||
|
|
||||||
|
|
||||||
function core.get_item_group(name, group)
|
function core.get_item_group(name, group)
|
||||||
if not core.registered_items[name] or not
|
local def = core.registered_items[name]
|
||||||
core.registered_items[name].groups[group] then
|
return def and def.groups[group] or 0
|
||||||
return 0
|
|
||||||
end
|
|
||||||
return core.registered_items[name].groups[group]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user