|
Programming: JavaScript
Patch Category:
Programming
Patch Name:
JavaScript
Patch First Appeared in Version:
10.4 (Tiger)
Patch Execution Mode:
Processor Patch Description:
Executes JavaScript code. Ordered vs. Unordered StructuresDepending on how you allocate structures, they will be either ordered arrays, or unordered dictionaries. This code result.Lines = new Array(); result.Lines[0] = 'foo'; result.Lines[1] = 'foo'; results in an ordered array, where element Whereas result.Lines = new Object(); results in an unordered array, where elements For example, the following code generates a line strip structure representing a circle: function (__structure Lines) main(__number Segments) { var result = new Object(); result.Lines = new Array(); for(i=0;i<Segments;++i) { result.Lines[i] = new Object(); result.Lines[i].X = Math.cos(i/Segments * 2 * 3.14)/2.0; result.Lines[i].Y = Math.sin(i/Segments * 2 * 3.14)/2.0; } return result; } Since Patch Inputs:
(user-defined) Patch Outputs:
(user-defined) Patch Inspector Settings:
Code Editor
|