ruipin / fvtt-lib-wrapper

Library for Foundry VTT which provides module developers with a simple way to modify core Foundry VTT code, while reducing the likelihood of conflict with other modules.
GNU Lesser General Public License v3.0
35 stars 15 forks source link

Handle toString() on a wrapped method #18

Closed ruipin closed 3 years ago

ruipin commented 3 years ago

Some modules, like Mess, attempt to patch existing methods by converting them to string first using toString(), applying a regex, and then replacing the original method.

Unfortunately, this is completely incompatible with any method wrapped by libWrapper, as toString() returns the source code of the libWrapper handler.

If possible, it might be a good idea to override the toString() method of the libWrapper handler function objects, and outright throw an exception, or if possible return the original method's toString() result.

ruipin commented 3 years ago

This is now done in v1.4.0.0, closing.