util: add reversible table method wrapping helper
util: add reversible table method wrapping helper

In some cases, it's useful to be able to wrap a function and either
replace its contents entirely or have some callback be run before
calling the underlying function.

The most obvious users for this feature are the Japanese and Korean
keyboards (both of which need to wrap the inputbox methods with either
their own versions or have basic callbacks be run before the method is
executed).

This is loosely based on how busted/luassert spies work.

Signed-off-by: Aleksa Sarai <b305c9b0212d6145eea67bbffd24e29cb79c759c@cyphar.com>

koreader/koreader,NiLuJe/koreader,koreader/koreader,poire-z/koreader,Frenzie/koreader,poire-z/koreader,NiLuJe/koreader,Frenzie/koreader