Search found 255 matches

by stam
Wed Mar 03, 2021 12:03 am
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Sort multidimensional array
Replies: 41
Views: 3599

Re: Sort multidimensional array

The main objection to "do" (and "value") is that they need to load the compiler which introduces overhead. In the case of the merge command you should get the same result using "get" instead, which has no extra overhead. get merge(tSortText) In this case "do" is only used once so the overhead will ...
by stam
Tue Mar 02, 2021 5:10 pm
Forum: Talking LiveCode
Topic: Extracting NMEA data from a USB port
Replies: 7
Views: 160

Re: Extracting NMEA data from a USB port

Would textDecode(binaryData, encoding) help?
by stam
Tue Mar 02, 2021 3:00 pm
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Modal dialog that can't be dismissed?
Replies: 10
Views: 233

Re: Modal dialog that can't be dismissed?

I had this issue when i upgraded to Big Sur

The LC team / Panos fixed this and other issues in the release candidates for 9.6.2. I'm using 9.6.2 RC2 and no longer have this issue.

I suspect that's the problem the OP has... but hopefully they can confirm.
by stam
Tue Mar 02, 2021 2:47 pm
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Sort multidimensional array
Replies: 41
Views: 3599

Re: Sort multidimensional array

Thanks Thierry - i think i get it now -- it's not so much a array.sort method but rather a way to refer to the elements of the array with a different index. I get how it this will be more lightweight especially when dealing with large arrays shifting binaries about etc. Using it is just slightly mor...
by stam
Tue Mar 02, 2021 12:32 pm
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Sort multidimensional array
Replies: 41
Views: 3599

Re: Sort multidimensional array

Thanks Thierry - but that confuses me more :) (easily done mind you...) Your handler returns a sorted index, not a sorted array, when i test this with a multidimensional array. As an example, when running my handler to sort a multidimensional array by the key ["identifier"] in descending order, i ge...
by stam
Tue Mar 02, 2021 11:14 am
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Sort multidimensional array
Replies: 41
Views: 3599

Re: Sort multidimensional array

Here is a variant which I guess is slightly faster and using less memory, but of course this has to be proved :) Thanks as always Thierry! However that won't sort multidimensional arrays i don't think? you don't make use of [pKey] and the code looks fairly identical to the previous one you posted:)...
by stam
Tue Mar 02, 2021 10:18 am
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Modal dialog that can't be dismissed?
Replies: 10
Views: 233

Re: Modal dialog that can't be dismissed?

The problem is that none of the buttons in this modal dialog do anything. My only recourse is to use the MacOS "Force Quit..." menu item to completely abort LiveCode. Have you upgraded to Big Sur? If so, have you updated LiveCode to 9.6.2 RC1 or greater? They fixed a number of glitches with Big Sur...
by stam
Tue Mar 02, 2021 9:47 am
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Sort multidimensional array
Replies: 41
Views: 3599

Re: Sort multidimensional array

Here is a link to my post from 2011 https://forums.livecode.com/viewtopic.php?f=32&t=7069&p=32207&hilit=hours+passing+parameter+reference#p32207 In it I estimate that an operation would take 56 hours, this was reduced to 70 seconds mostly by switching to referenced variable passing. Mind you the va...
by stam
Tue Mar 02, 2021 9:22 am
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Sort multidimensional array
Replies: 41
Views: 3599

Re: Sort multidimensional array

...there was an issue with using the "do" command.... ...somehow related to Apple not liking programs that have potentially self-altering code in their App Store.... I must say, that seems unlikely.... I’d be surprised if Apple did a code-level review of apps (but really have no idea). Plus there’s...
by stam
Mon Mar 01, 2021 6:01 pm
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Sort multidimensional array
Replies: 41
Views: 3599

Re: Sort multidimensional array

I often enjoy these randomly/organically growing discussions :) Good to know about lock screen - i've used it but haven't seen a massive increase in speed but maybe i've not been doing stuff that was taxing enough to make it obvious (and haven't bothered time-logging) I guess it will (almost?) never...
by stam
Mon Mar 01, 2021 1:10 pm
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Sort multidimensional array
Replies: 41
Views: 3599

Re: Sort multidimensional array

Excellent - 3 lines less :) Final code (so far!) tested with one 1-dimensional and one multidimensional array: function sortArray @pArray, pDirection, pSortType, pKey local tNextIndex, tSortedArray, tSortText if (pDirection is not in "ascending,descending" and pDirection is not empty) or \ ( pSortTy...
by stam
Mon Mar 01, 2021 12:42 pm
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Sort multidimensional array
Replies: 41
Views: 3599

Re: Sort multidimensional array

Mmm, actually I warned you about this... Yep, you did indeed. As always i'm ever so grateful for all your advice and contributions which i've found absolutely invaluable during my short time on this forum (especially with regex!) - didn't mean anything by my comment, just that that was needed for m...
by stam
Mon Mar 01, 2021 12:00 pm
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Sort multidimensional array
Replies: 41
Views: 3599

Re: Sort multidimensional array

Thanks once again Thierry and everyone who contributed to this discussion. @Thierry - great code- was unaware of the merge() function, works a charm but you were missing the [pKey] after pArray[each] in the merge() statement. Works like a charm once added :) @bobcole, @skids: good code, i was doing ...
by stam
Mon Mar 01, 2021 10:32 am
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Sort multidimensional array
Replies: 41
Views: 3599

Re: Sort multidimensional array

Thierry wrote:
Mon Mar 01, 2021 9:54 am
use instead a do merge() to dynamically edit the sort command based on your parameters...
Ah, thank you Thierry! Merge() was the function I was missing, looks like the ticket. Will test after work but looks like it should work perfectly, thank you!

Happy new month to you too :)
by stam
Mon Mar 01, 2021 3:09 am
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Sort multidimensional array
Replies: 41
Views: 3599

Re: Sort multidimensional array

i could add nested conditional statements inline to keep it as 1 function... (ugh!) This now works and is fully generalisable for array sorting - specifying a key, sort direction and sort type as parameters... but the code is now is so much longer and unpleasant. Grateful on suggestions to refactor...

Go to advanced search