cesanta / v7

Embedded JavaScript engine for C/C++
Other
1.42k stars 177 forks source link

Object enumeration in C #545

Closed wenq1 closed 8 years ago

wenq1 commented 8 years ago

I have a JS object var testobj {a: 'test1', b: 'test2'} the keys of which I would like to enumerate in C. This is particularly useful if I want to set header fields for HTTP requests. In JS I know I can do:

for (var i in testobj) do {
    printLog ('key': i, 'val': testobj[i]
}

I wonder is there an enumeration function in v7's native C API allowing me to enumerate v7_val_t?

cpq commented 8 years ago

v7_next_prop() is the API you're looking for.