-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMC2DebugLib.lua
1 lines (1 loc) · 15.9 KB
/
MC2DebugLib.lua
1
77u/bG9jYWwgQWRkb25OYW1lLCBBZGRvbiA9IC4uLg0KDQpBZGRvbi5EZWJ1Z0xpYiA9DQp7DQoJVmVyc2lvbiA9IDEsDQp9DQoNCmlmIG5vdCBBZGRvbi5EZWJ1Z0NvbG9yQ29kZSB0aGVuDQoJQWRkb24uRGVidWdDb2xvckNvZGUgPSBHUkVFTl9GT05UX0NPTE9SX0NPREUNCmVuZA0KDQotLSBBZGQgdGhlIC9yZWxvYWR1aSBjb21tYW5kIGlmIGl0IGlzbid0IGFscmVhZHkgaW5zdGFsbGVkDQoNCmlmIG5vdCBTTEFTSF9SRUxPQURVSTEgdGhlbg0KCVNsYXNoQ21kTGlzdC5SRUxPQURVSSA9IGZ1bmN0aW9uICgpIGlmIFNsYXNoQ21kTGlzdC5TV0FUVEVSIHRoZW4gU2xhc2hDbWRMaXN0LlNXQVRURVIoImNsZWFyIikgZW5kIFJlbG9hZFVJKCkgZW5kDQoJU0xBU0hfUkVMT0FEVUkxID0gIi9yZWxvYWR1aSINCmVuZA0KDQppZiBub3QgdGVybiB0aGVuDQoJZnVuY3Rpb24gdGVybihhLCBiLCBjKQ0KCQlpZiBhIHRoZW4gcmV0dXJuIGIgZWxzZSByZXR1cm4gYyBlbmQNCgllbmQNCmVuZA0KDQpmdW5jdGlvbiBBZGRvbi5EZWJ1Z0xpYjpJbml0aWFsaXplKCkNCglpZiBzZWxmLkluaXRpYWxpemVkIHRoZW4NCgkJcmV0dXJuDQoJZW5kDQoJDQoJc2VsZi5Jbml0aWFsaXplZCA9IHRydWUNCgkNCglob29rc2VjdXJlZnVuYygNCgkJCSJDaGF0RnJhbWVfQ29uZmlnRXZlbnRIYW5kbGVyIiwNCgkJCWZ1bmN0aW9uIChldmVudCkNCgkJCQlpZiBldmVudCA9PSAiVVBEQVRFX0NIQVRfV0lORE9XUyINCgk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