Help please: Cloning callbacks

Aftermoth
Member
 
Posts: 22
Joined: Wed Apr 06, 2016 01:26

Help please: Cloning callbacks

by Aftermoth » Mon Apr 11, 2016 07:50

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?
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: Help please: Cloning callbacks

by rubenwardy » Mon Apr 11, 2016 08:27

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.
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 4 guests

cron