Jump to content

Can I override LUA functions?


blindcoder

Recommended Posts

Hello.

 

I want to change some behaviour in the current trapping system. For that, I want to override ISTrap:addBait and ISTrap:removeBait.

 

Is that possible by just creating a media/lua/server/Traps/ISTrap.lua and re-defining those two functions? Or is there some more magic to do so?

Link to comment
Share on other sites

I am brand spankin new to this LUA stuff but I *think* the answer is yes.  Any LUA in the mods folder with same named functions will overwrite base code LUA.

 

I'm interested in hearing if someone can confirm.  I'd like to embed new functions to existing base functions for my next mod.

Link to comment
Share on other sites

Just to dive further down the rabbit hole, Blindcoder doesn't need to overwrite the entire ISTrap.lua if he's only altering specific functions within ISTrap.lua (assuming ISTrap.lua has multiple functions inside - I can't check at the moment), correct?  He could create his own file called ISBlindCoderTrap.lua, include only the functions he is tweaking but use the base function name, drop it in the proper mod folder, and he would be good to go?

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