1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-13 00:25:19 +02: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:
Erich Schubert
2024-10-14 22:09:01 +02:00
committed by GitHub
parent 7435ea0d4e
commit 6431ef7324

View File

@@ -25,11 +25,8 @@ end
function core.get_item_group(name, group)
if not core.registered_items[name] or not
core.registered_items[name].groups[group] then
return 0
end
return core.registered_items[name].groups[group]
local def = core.registered_items[name]
return def and def.groups[group] or 0
end