As shown above the code should look like this:
Lua Code:
ZO_PreHook("TogglePlayerWield", function()
d("TogglePlayerWield was used")
return false -- reutn false to run original function code of TogglePlayerWield afterwards!
end
ZO_PreHook(objectTable, existingFunctionName, hookFunction)
objectTable: The name of an object (e.g. SMITHING) or if it is the global namespace (_G) you can just pass the function name existingFunctionName without the objectTable.
existingFunctionName: The name of the function you'd like to preHook, in string quotes " "
hookFunction: Your definded hook function or an anonymouse function within the prehook like shown above in my example code.
So your code should look like this e.g.
Lua Code:
ZO_PreHook("TogglePlayerWield", function()
myAddon.TogglePlayerWield()
return false -- return false to run original function code of TogglePlayerWield afterwards!
end)
This is the same:
Lua Code:
ZO_PreHook(_G, "TogglePlayerWield", function()
myAddon.TogglePlayerWield()
return false -- return false to run original function code of TogglePlayerWield afterwards!
end)