[Laszlo-user] Laszlo function as Array.sort argument

Pablo Kang pkang at laszlosystems.com
Wed Jan 9 12:00:05 PST 2008


Ah, looks like it does! Weird. Any ideas why? Thanks.

On Wed, 9 Jan 2008, Henry Minsky wrote:

> I think the call to Debug.write is killing it.
>
>
>
> On Jan 9, 2008 2:28 PM, Pablo Kang <pkang at laszlosystems.com> wrote:
>
>> Btw, I know that I can call a laszloMethod from a Javascript function
>> like:
>>
>>   <method name="javascriptFunction" args="n1,n2">
>>       return canvas.laszloMethod(n1,n2);
>>   </method>
>>
>> What I want to know is why it is I can't pass in the the laszloMethod
>> directly.
>>
>> Thanks,
>> pablo
>>
>> On Wed, 9 Jan 2008, Pablo Kang wrote:
>>
>>> Anyone know why passing in a function defined with an LZX method tag
>> into
>>> Array.sort doesn't work? Here's a test case:
>>>
>>> <canvas debug="true">
>>>
>>>    <method name="laszloMethod" args="n1,n2">
>>>        Debug.write('laszloMethod(', n1, ',', n2, ')');
>>>        return 0;
>>>    </method>
>>>
>>>    <script>
>>>        function javascriptFunction(n1,n2) {
>>>            Debug.write('javascriptFunction(', n1, ',', n2 ,')');
>>>            return 0;
>>>        }
>>>    </script>
>>>
>>>    <handler name="oninit">
>>>        var arr = [ 1,2,3 ];
>>>
>>>        Debug.write('-- Javascript Function --');
>>>        arr.sort( javascriptFunction );
>>>
>>>        Debug.write('-- Laszlo Method --------');
>>>        arr.sort( canvas.laszloMethod );
>>>    </handler>
>>>
>>> </canvas>
>>>
>>> pablo
>>>
>>>
>>>
>>
>
>
>
> -- 
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com
>


More information about the Laszlo-user mailing list