Sorata_Kanda Posted January 18, 2019 Share Posted January 18, 2019 Hey everyone, I'm wondering if you're able to override existing functions. I can image that doing on OOP side, but I don't know if it's possible to do so on a normal function. For example: function _setElementData( player, key, value ) -- Wrapper return setElementData( player, key, value, false ) end Element.setData = _setElementData -- OOP -- But why to do it on setElementData? Just simply setElementData = _setElementData? Thanks in advance! Link to comment
Discord Moderators Pirulax Posted January 18, 2019 Discord Moderators Share Posted January 18, 2019 You can: local _setElementData = setElementData -- Store the function in a var function setElementData( player, key, value ) -- Wrapper return _setElementData( player, key, value, false ) -- call the old function end Element.setData = setElementData -- OOP Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now