Category:LSL Negative Index

From Second Life Wiki
Revision as of 13:24, 6 March 2007 by Kelly Linden (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Negative indexes cound backwards from the end. For string s = "Hello World"

  • Index 0 is 'H' (llGetSubString(s,0,0))
  • Index -1 is 'd' (llGetSubString(s,-1,-1))
  • Index -5 is 'W' (llGetSubString(s,-5,-5))


Care must be taken when using the results of any llGet* function that returns an index in combination with the functions in this category. The llGet* functions will return an index of -1 to indicate 'not found', which if used in these functions is a valid index - but probably not the one you want.