Jump to content
Sign in to follow this  
Maris

How to overwrite a vanilla function?

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...