Difference between revisions of "User talk:LepreKhaun Resident/Workaround4Escaped Chars within JsonText"

From Second Life Wiki
Jump to navigation Jump to search
m
 
(2 intermediate revisions by 2 users not shown)
Line 14: Line 14:
while ((iter += step) < 0)</lsl>
while ((iter += step) < 0)</lsl>
:-- '''[[User:Strife_Onizuka|Strife]]''' <sup><small>([[User talk:Strife_Onizuka|talk]]|[[Special:Contributions/Strife_Onizuka|contribs]])</small></sup> 10:28, 14 October 2013 (PDT)
:-- '''[[User:Strife_Onizuka|Strife]]''' <sup><small>([[User talk:Strife_Onizuka|talk]]|[[Special:Contributions/Strife_Onizuka|contribs]])</small></sup> 10:28, 14 October 2013 (PDT)
:Both excellent suggestions, ty! Have gone with the first one, feeling it is the more readable of the 2.
:Will look over the coding a bit more for this as well as the (4K in size) workaround for uJsonGetValue. Had hoped there wouldn't be a need for any of this but LL remains determined not to fix our implementation. meh -- [[User:LepreKhaun Resident|LepreKhaun Resident]] 19:51, 15 October 2013 (PDT)
:: At least I can welcome you to the club. Don't worry, after you tilt with LL a few times eventually you win a round. -- '''[[User:Strife_Onizuka|Strife]]''' <sup><small>([[User talk:Strife_Onizuka|talk]]|[[Special:Contributions/Strife_Onizuka|contribs]])</small></sup> 02:04, 16 October 2013 (PDT)
:: P.S. I couldn't help myself.
<lsl>integer iter = ~llGetListLength(values);
// Step through list, hitting every other item if JSON_OBJECT
integer step = 1 + (type == JSON_OBJECT);
while ((iter += step) & 0x80000000)</lsl>

Latest revision as of 02:11, 16 October 2013

Loop

That is a little ugly. <lsl>while ((iter = ++iter + (type == JSON_OBJECT)) < listLength)</lsl> For readability and speed I would recommend this: <lsl>integer step = 1 + (type == JSON_OBJECT); while ((iter += step) < listLength)</lsl> -- Strife (talk|contribs) 10:15, 14 October 2013 (PDT)

If you are ok with negative indexing you can simplify it more...

<lsl>integer iter = ~llGetListLength(values); // Step through list, hitting every other item if JSON_OBJECT integer step = 1 + (type == JSON_OBJECT); while ((iter += step) < 0)</lsl>

-- Strife (talk|contribs) 10:28, 14 October 2013 (PDT)
Both excellent suggestions, ty! Have gone with the first one, feeling it is the more readable of the 2.
Will look over the coding a bit more for this as well as the (4K in size) workaround for uJsonGetValue. Had hoped there wouldn't be a need for any of this but LL remains determined not to fix our implementation. meh -- LepreKhaun Resident 19:51, 15 October 2013 (PDT)
At least I can welcome you to the club. Don't worry, after you tilt with LL a few times eventually you win a round. -- Strife (talk|contribs) 02:04, 16 October 2013 (PDT)
P.S. I couldn't help myself.

<lsl>integer iter = ~llGetListLength(values); // Step through list, hitting every other item if JSON_OBJECT integer step = 1 + (type == JSON_OBJECT); while ((iter += step) & 0x80000000)</lsl>