mirror of https://github.com/Icinga/icinga2.git
parent
b64c13cf3c
commit
95a7473643
|
@ -554,6 +554,14 @@ Signature:
|
||||||
Sets the element at the zero-based index to the specified value. The `index` must refer to an element
|
Sets the element at the zero-based index to the specified value. The `index` must refer to an element
|
||||||
which already exists in the array.
|
which already exists in the array.
|
||||||
|
|
||||||
|
### <a id="array-get"></a> Array#get
|
||||||
|
|
||||||
|
Signature:
|
||||||
|
|
||||||
|
function get(index);
|
||||||
|
|
||||||
|
Retrieves the element at the specified zero-based index.
|
||||||
|
|
||||||
### <a id="array-sort"></a> Array#sort
|
### <a id="array-sort"></a> Array#sort
|
||||||
|
|
||||||
Signature:
|
Signature:
|
||||||
|
@ -616,6 +624,15 @@ Signature:
|
||||||
|
|
||||||
Creates or updates an item with the specified `key` and `value`.
|
Creates or updates an item with the specified `key` and `value`.
|
||||||
|
|
||||||
|
### <a id="dictionary-get"></a> Dictionary#get
|
||||||
|
|
||||||
|
Signature:
|
||||||
|
|
||||||
|
function get(key);
|
||||||
|
|
||||||
|
Retrieves the value for the specified `key`. Returns `null` if they `key` does not exist
|
||||||
|
in the dictionary.
|
||||||
|
|
||||||
## <a id="scriptfunction-type"></a> Function type
|
## <a id="scriptfunction-type"></a> Function type
|
||||||
|
|
||||||
### <a id="scriptfunction-call"></a> Function#call
|
### <a id="scriptfunction-call"></a> Function#call
|
||||||
|
|
|
@ -40,6 +40,13 @@ static void ArraySet(int index, const Value& value)
|
||||||
self->Set(index, value);
|
self->Set(index, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Value ArrayGet(int index)
|
||||||
|
{
|
||||||
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
|
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
||||||
|
return self->Get(index);
|
||||||
|
}
|
||||||
|
|
||||||
static void ArrayAdd(const Value& value)
|
static void ArrayAdd(const Value& value)
|
||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
|
@ -131,6 +138,7 @@ Object::Ptr Array::GetPrototype(void)
|
||||||
prototype = new Dictionary();
|
prototype = new Dictionary();
|
||||||
prototype->Set("len", new Function(WrapFunction(ArrayLen)));
|
prototype->Set("len", new Function(WrapFunction(ArrayLen)));
|
||||||
prototype->Set("set", new Function(WrapFunction(ArraySet)));
|
prototype->Set("set", new Function(WrapFunction(ArraySet)));
|
||||||
|
prototype->Set("get", new Function(WrapFunction(ArrayGet)));
|
||||||
prototype->Set("add", new Function(WrapFunction(ArrayAdd)));
|
prototype->Set("add", new Function(WrapFunction(ArrayAdd)));
|
||||||
prototype->Set("remove", new Function(WrapFunction(ArrayRemove)));
|
prototype->Set("remove", new Function(WrapFunction(ArrayRemove)));
|
||||||
prototype->Set("contains", new Function(WrapFunction(ArrayContains)));
|
prototype->Set("contains", new Function(WrapFunction(ArrayContains)));
|
||||||
|
|
|
@ -38,6 +38,13 @@ static void DictionarySet(const String& key, const Value& value)
|
||||||
self->Set(key, value);
|
self->Set(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Value DictionaryGet(const String& key)
|
||||||
|
{
|
||||||
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
|
Dictionary::Ptr self = static_cast<Dictionary::Ptr>(vframe->Self);
|
||||||
|
return self->Get(key);
|
||||||
|
}
|
||||||
|
|
||||||
static void DictionaryRemove(const String& key)
|
static void DictionaryRemove(const String& key)
|
||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
|
@ -67,6 +74,7 @@ Object::Ptr Dictionary::GetPrototype(void)
|
||||||
prototype = new Dictionary();
|
prototype = new Dictionary();
|
||||||
prototype->Set("len", new Function(WrapFunction(DictionaryLen)));
|
prototype->Set("len", new Function(WrapFunction(DictionaryLen)));
|
||||||
prototype->Set("set", new Function(WrapFunction(DictionarySet)));
|
prototype->Set("set", new Function(WrapFunction(DictionarySet)));
|
||||||
|
prototype->Set("get", new Function(WrapFunction(DictionaryGet)));
|
||||||
prototype->Set("remove", new Function(WrapFunction(DictionaryRemove)));
|
prototype->Set("remove", new Function(WrapFunction(DictionaryRemove)));
|
||||||
prototype->Set("contains", new Function(WrapFunction(DictionaryContains)));
|
prototype->Set("contains", new Function(WrapFunction(DictionaryContains)));
|
||||||
prototype->Set("clone", new Function(WrapFunction(DictionaryClone)));
|
prototype->Set("clone", new Function(WrapFunction(DictionaryClone)));
|
||||||
|
|
Loading…
Reference in New Issue