Hi,
nice workaround
Here the same slightly optimized (predefined as Javascript function):
|
Source code
|
1
2
3
4
5
6
|
<action autorun="preinit" type="Javascript">
actions.value_array_push = function(array, val)
{
resolve(array).push(val);
}
</action>
|
Or here another possibility - a custom function that 'extends' an Array object with a push function that works:
|
Source code
|
1
2
3
4
5
6
7
8
|
<action autorun="preinit" type="Javascript">
actions.add_push_support = function(array)
{
array = resolve(array);
array._push = array.push;
array.push = function(v){ array._push(v); };
}
</action>
|
To use it:
|
Source code
|
1
2
3
4
5
6
7
8
|
def(some_array, array);
add_push_support (some_array);
some_array.push('test');
some_array.push('test2');
...
set(debugmode,true);
debugvar(test);
showlog();
|
Btw it would be nice to add some special function which could not be called to the official document.
Do you mean Javascript functions?
There are no general limitations, but the Array.push function is a special case in Javascript, please search for 'array push apply' to find more detailed explanations about that.
Best regards,
Klaus