OTH
Layered native-function replacements and their calling-thread context.
The oth table manages layered native-function replacements with a logical calling-thread context. It is separate from the standard closure APIs.
oth.hook
oth.hook(target: function, replacement: function, inlineOrFilter: boolean | FilterBase?): functionAdds a replacement layer to a C target and returns the previous-call relay. The replacement must be a Lua function. The third argument is either the legacy inline boolean or a FilterBase; a filter does not implicitly enable inline mode. Invalid targets and incompatible existing modifications raise an argument error.
oth.unhook
oth.unhook(target: function, selector: function?): booleanRemoves the selected replacement/relay layer, or all enabled layers when selector is omitted. Returns whether any layer was removed. Active calls retain the resources they need until completion.
oth.get_root_callback
oth.get_root_callback(): function?Returns the root previous-call callback for the current active replacement invocation, or nil outside that context.
oth.is_hook_thread
oth.is_hook_thread(): booleanReturns whether the current thread belongs to a managed replacement invocation.
oth.get_original_thread
oth.get_original_thread(): thread?Returns the original calling thread for the current managed invocation, or nil outside that context.
oth._ydiag
oth._ydiag(): (number, number, number, number, number, number)Returns six internal diagnostic counters in source order: collapse, protected-call, namecall, continuation-present, direct-call and cloned-continuation counts. This diagnostic is currently registered on the oth table.
Written for Lynx 0.0.0
Something unclear? Tell us on Discord