Jump to content

Recommended Posts

When modding an existing character, can you override just one function?
for example the Client_CanUpgradeWithModule(inst, module_prefab) function from wx78.lua file

also can you hook a function so it runs like normal but also runs your code before or after it exicutes?

Edited by alamancer

Use this:

 AddPrefabPostInit("prefab", function(inst)
	_target_function = inst.fn.path -- Store the original function
	inst.fn.path = function(inst, ...) 
		-- your code
		_target_function(inst, ...)
	end
end)
		

This is a function hook, for overwrite you can just ignore the _target_function. For more details, see this amazing post by CarlZalph.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...