Hooking

Documentation of hooking-related Synapse Z environment functions

hookfunction

function hookfunction(target: function, hook: function, filter: Filter?)

hooks the target function with optional hook filter, returns a clone of the target function

restorefunction

void restorefunction(target: function)

restores the target function, errors if not hooked

isfunctionhooked

bool isfunctionhooked(target: function)

returns whenever the target function is hooked or not

hookmetamethod

function hookmetamethod(object: any, metamethod: string, hook: function, arg_guard: bool?, filter: Filter?)

hooks the target object metamethod with optional arg guard and hook filter, returns a clone of the target object metamethod

restoremetamethod

void restoremetamethod(object: any, metamethod: string)

restores the target object metamethod, errors if not hooked

ismetamethodhooked

bool ismetamethodhooked(object: any, metamethod: string)

returns whenever the target object metamethod is hooked or not

hookproto

function hookfunction(target: function, hook: function)

target function must be a lua function hooks the target function, returns a clone of the target function

restoreproto

void restorefunction(target: function)

target function must be a lua function restores the target function, errors if not hooked

isfunctionhooked

bool isprotohooked(target: function)

target function must be a lua function returns whenever the target function is hooked or not

getfilter

function getfilter(unfiltered: function, filtered: function, filter: Filter)

converts specified functions into a "filtered" function, see Filter