Originally Posted by Lombra
Well of course if you explicitly do not use a pointer created before hooking it's going to work, but no, as I've recently learnt, hooksecurefunc actually replaces the function and there's no magic at all.
This does not print anything:
Code:
local SetCVar = SetCVar
hooksecurefunc("SetCVar", function(name, value)
if name == "Sound_EnableMusic" then
print(name, value)
end
end)
SetCVar("Sound_EnableMusic", 1)
|
That does work. as hooksecurefunc is more like a callback and is called immediately after the global function is called.
Lua Code:
local globalIndexName = "SetCVar"
hooksecurefunc(globalIndexName, function(...) end)
So globalIndexName is a _G[index] value. You can abuse this for most work that runs alongside the default WoW interface. However, of course, it only works for functions and most frame functions that are global.
You can find some more info on
WoWProgramming.