Page 1 of 1

Help please: Cloning callbacks

PostPosted: Mon Apr 11, 2016 07:50
by Aftermoth
While a mod is loading
I want to copy an already registered node callback
and include it within a different callback definition
such that it adds the same behaviour.

I can't seem to find any combination of copying, cloning, or closures that isn't "Error in error handling" or nothing.

I am aware that I could prolly use IO and string operations to crawl through the relevant mod files, but I'm going for something a bit cleaner.

Failing that, how can I detect whether a registered node callback is defined as something, rather than a stub?

Re: Help please: Cloning callbacks

PostPosted: Mon Apr 11, 2016 08:27
by rubenwardy
minetest.registered_items[name].on_punch

Will be nil if the function does not exist
Name is the item name, and does not start with a colon.