Talk:SubStringLastIndex

From Second Life Wiki
Jump to navigation Jump to search

@ Recursion

Normally I would've just whacked such a dangerous code, but recursion is a (normally) valid handling method, and and I can imagine cases with long string that are known to generate few multiple that it might be workable with, so I just tagged it with the warning... of course this ignores the fact that LSL is pass-by-value, odds are it's gonna blow up in almost any scenario... perhaps I (or some bored person) should write the proper looping version? just a thought =)
-- Void (talk|contribs) 04:11, 27 March 2012 (PDT)

I once had a situation in LSL where recursion was the best solution (optimized for bytecode to avoid stack-heap collision). I don't approve of this implementation either. I might be board enough this week end. -- Strife (talk|contribs) 22:03, 27 March 2012 (PDT)
Specifically I needed to take the first six characters off the start of a string and convert those six into a list, one character per list item. Recursion was cheaper in bytecode than looping. It was for TLMR, name of the function is token: TLMLRenderer, that entire project was killed by LSO stack-heap collisions. It was too costly to keep adding on functionality. That code is an example of devious bytecode optimizations, later versions were even more devious. -- Strife (talk|contribs) 09:57, 28 March 2012 (PDT)