lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Zhuang Zhao <zhuazhao@yahoo.com> writes:
> function hookFunction()
>     local oldTick = PowerStruggle.OnTick;
>     LogAlways("oldfunc:"..tostring(PowerStruggle.OnTick));
>     PowerStruggle.OnTick = function()
...
> This hook function, however, does not work. It just prints the original
> ++++++++++++OnTick++++++++++ rather than both. Also, the LogAlways statement shows the memory address for the function is changing. Anyone have any idea why it's failing? 

Perhaps whoever calls PowerStruggle.OnTick has cached it in a variable
and calls that instead.

-Miles

-- 
Happiness, n. An agreeable sensation arising from contemplating the misery of
another.