Returns a list of keys for all items that are currently in the dictionary.
+### <a id="dictionary-keys"></a> Dictionary#values
+
+Signature:
+
+ function values();
+
+Returns a list of values for all items that are currently in the dictionary.
+
## <a id="scriptfunction-type"></a> Function type
Inherits methods from the [Object type](18-library-reference.md#object-type).
return keys;
}
+static Array::Ptr DictionaryValues(void)
+{
+ ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
+ Dictionary::Ptr self = static_cast<Dictionary::Ptr>(vframe->Self);
+ Array::Ptr keys = new Array();
+ ObjectLock olock(self);
+ for (const Dictionary::Pair& kv : self) {
+ keys->Add(kv.second);
+ }
+ return keys;
+}
+
Object::Ptr Dictionary::GetPrototype(void)
{
static Dictionary::Ptr prototype;
prototype->Set("contains", new Function("Dictionary#contains", WrapFunction(DictionaryContains), { "key" }, true));
prototype->Set("shallow_clone", new Function("Dictionary#shallow_clone", WrapFunction(DictionaryShallowClone), {}, true));
prototype->Set("keys", new Function("Dictionary#keys", WrapFunction(DictionaryKeys), {}, true));
+ prototype->Set("values", new Function("Dictionary#values", WrapFunction(DictionaryValues), {}, true));
}
return prototype;