Add a debug hook to any LL library function
Frionil Fang
The ll table is frozen, but it can be cloned and modified to enable a debug mode that lets you track function calls or perform other tricks.
SCRIPTDEBUG = true
if SCRIPTDEBUG then
llDEBUG = ll -- store original ll table reference
ll = table.clone(ll) -- replace with modifiable version
-- then modify the function with debug info; calls original function afterwards
ll.Say = function(c, s) llDEBUG.OwnerSay(`(DEBUG:Say at line {debug.info(2,'l')-1})`); llDEBUG.Say(c, s) end
end
ll.Say(0, "test")
This of course costs a considerable chunk of memory as per gcinfo(), so it may not be tenable if/when harder memory limits set in.
Log In