1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-01 17:38:41 +00:00

Warn if metatable passed to itemdef registration function

This commit is contained in:
sfan5 2025-03-16 16:46:37 +01:00
parent 4125ce877d
commit 2540667f04
3 changed files with 12 additions and 6 deletions

View file

@ -9,8 +9,8 @@ do
all.registered_craftitems = {}
all.registered_tools = {}
for k, v in pairs(all.registered_items) do
-- Disable further modification
setmetatable(v, {__newindex = {}})
-- Ignore new keys
setmetatable(v, {__newindex = function() end})
-- Reassemble the other tables
if v.type == "node" then
getmetatable(v).__index = all.nodedef_default