mirror of https://github.com/arendst/Tasmota.git
Merge pull request #13434 from s-hadinger/berry_json_dump
Berry json dump for subclasses
This commit is contained in:
commit
1360d68540
|
@ -45,8 +45,19 @@ static const char* match_char(const char *json, int ch)
|
||||||
static int is_object(bvm *vm, const char *class, int idx)
|
static int is_object(bvm *vm, const char *class, int idx)
|
||||||
{
|
{
|
||||||
if (be_isinstance(vm, idx)) {
|
if (be_isinstance(vm, idx)) {
|
||||||
|
be_pushvalue(vm, idx);
|
||||||
|
while (1) {
|
||||||
|
be_getsuper(vm, -1);
|
||||||
|
if (be_isnil(vm, -1)) {
|
||||||
|
be_pop(vm, 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
be_remove(vm, -2);
|
||||||
|
}
|
||||||
const char *name = be_classname(vm, idx);
|
const char *name = be_classname(vm, idx);
|
||||||
return !strcmp(name, class);
|
bbool ret = !strcmp(name, class);
|
||||||
|
be_pop(vm, 1);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue