there is the CodeaCommunity and it has an autorun function which uses debug.sethook to auto-install its setup() routine into the current projects setup(). But what if I wanted to encapsulate this functionality to allow ALL my projects to be in-hook-able? Say I have 3 projects:
-
“Backup” : (which has some parameter.integer sliders in its setup())
-
“Monitor” : (which displays parameter.watch’es for monitoring fps and memory usage)
-
“PingPongGame” : (the actual game, which should include the other 2 projects and hook-in their BOTH setup()'s)
How would I write the debug.sethook ? I tried undless possibilities, but the only the last project I inlude into my game gets hooked. The first one gets overriden on import… Any ideas?
PS: Here’s the function from CC
local s_setup
debug.sethook(function(event)
if setup and setup ~= s_setup then
o_setup = setup
setup = function()
debug.sethook()
if hook then hook() end
o_setup()
end
s_setup = setup
end
end, "r")