LÖVE HÖÖKS
Posted: Mon Jul 06, 2015 8:19 am
I'm currently working on( Or more or less have a very good idea and some implementation ideas ) a hook system, it will allow you to add functions to be called whenever a love function is called. This can be extremely useful if you want to add something to a current function without overwriting what is already in the function. I will represent a small little example below, this is something quite similar to GMOD's hook system( if you're familiar with that, if not you should go check it out ).
This would add onto the beginning of the list of functions to call in the function love.update()
This would overwrite the main function of the love.update()
The idea behind this is allowing more options, I myself have personally seen this as something that would be very useful in many cases. I'm going to make this regardless of what is said in this thread. However whether I release it to the public to use is up to you, do you think this is a good idea and should be posted on the forums for use by public, Please vote on the poll and/or leave a comment below of any ideas you might have for this! Thanks everyone -Nick
This would add onto the beginning of the list of functions to call in the function love.update()
Code: Select all
local LV = {}
function LV.Update( dt )
AVariableHere = AVariableHere + dt
end
hook.add( "loveupdate", "NicksUpdateAddition1", LV.Update )
Code: Select all
local LV = {}
local function LV.UpdateMain( dt )
Server.UpTime = Server.UpTime + dt
end
hook.overWrite( "loveupdate", LV.UpdateMain )