Module extend_item.lua
Extend callbacks of a registered node by wrapping them.
Allows injecting behavior before/after an existing callback while still optionally calling the original implementation via next. This works on boths nodes and items as it uses core.override_item under the hood.
See alsoUsage
extend_item("default:stone", {
on_punch = function(next, pos, node, puncher, pointed_thing)
minetest.chat_send_all("Stone punched!")
if next then
return next()
end
end
})