From d0c01800a6dc6ffd463d80c102b16d477cfcf058 Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Sun, 4 Jun 2023 21:29:02 +0200 Subject: [PATCH] added inspect to perf --- src/kernel/peripherals/Peripherals.hx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/kernel/peripherals/Peripherals.hx b/src/kernel/peripherals/Peripherals.hx index 0582b83..9d40485 100644 --- a/src/kernel/peripherals/Peripherals.hx +++ b/src/kernel/peripherals/Peripherals.hx @@ -54,6 +54,25 @@ class Peripheral { return addr; } + public function inspect(addr: String): Null<{ types: Array, methods: Array}> { + if (!isPresent(addr)) { + return null; + } + + var types = getTypes(addr); + var methodsMap = cc.Peripheral.getMethods(addr).toArray(); + var methods: Array = []; + + for (method in methodsMap) { + methods.push(method); + } + + return { + types: types, + methods: methods + }; + } + public function getScreen(addr: String): Null { var addr = safeGetAddr(addr, Screen.TYPE_NAME); if (addr == null) return null;