From 99037b136634e3463442e44661787a8c8ee7b14b Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Fri, 14 Jan 2022 17:47:24 +0100 Subject: [PATCH] Berry int() converts comptr --- lib/libesp32/berry/src/be_baselib.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/libesp32/berry/src/be_baselib.c b/lib/libesp32/berry/src/be_baselib.c index 98f96b48e..f09c5f812 100644 --- a/lib/libesp32/berry/src/be_baselib.c +++ b/lib/libesp32/berry/src/be_baselib.c @@ -233,6 +233,9 @@ static int l_int(bvm *vm) be_pushvalue(vm, 1); } else if (be_isbool(vm, 1)) { be_pushint(vm, be_tobool(vm, 1) ? 1 : 0); + } else if (be_iscomptr(vm, 1)) { + intptr_t p = (intptr_t) be_tocomptr(vm, 1); + be_pushint(vm, (int) p); } else { be_return_nil(vm); }