Jump to content

How to overwrite a vanilla function?


Maris

Recommended Posts

I'm trying but my function doesn't work. What am I doing wrong?

print('Hello!'); -- test passed, the mod is working
require "recipecode"
local old_RipClothing_OnCreate = RipClothing_OnCreate;
if not old_RipClothing_OnCreate then
	error('ERROR: Cant inject into RipClothing_OnCreate'); -- test passed (no error, defualt function found)
end
function RipClothing_OnCreate(items, result, player, ...) -- trying overwrite
	print('Huh?'); -- test not passed! the code does not work
	return old_RipClothing_OnCreate(items, result, player, ...)
end

 

Edited by Maris
Link to comment
Share on other sites

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...