On Sun, Aug 10, 2014 at 5:36 AM, Ingwie Phoenix
<[email protected]> wrote:
> Hey.
>
> I want to be able to iterate over an object to get the keys and values. Lets
> assume I export a JS function like this:
>
> applySettings({
> a: 1,
> b: 2
> });
>
> How can I now iterate over the object's keys and values in C++? I have not
> found an iterator class alike std::map<...>::iterator
object->GetPropertyNames() or object->GetOwnPropertyNames(), then
iterate over the returned array.
Local<Array> properties = object->GetPropertyNames();
for (uint32_t i = 0, k = properties.Length(); i < k; i += 1) {
Local<Value> key = properties->Get(i);
Local<Value> value = object->Get(key);
// ...
}
--
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.