diff options
author | David Walter Seikel | 2012-02-23 03:24:14 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-02-23 03:24:14 +1000 |
commit | ce012fbbc787702bdb008c9395a80d2a08935593 (patch) | |
tree | dce072ec4dd5dd42f0c24f2277ca9c8a155217d4 /LuaSL/src | |
parent | Fake some more functions in the test harness. (diff) | |
download | SledjHamr-ce012fbbc787702bdb008c9395a80d2a08935593.zip SledjHamr-ce012fbbc787702bdb008c9395a80d2a08935593.tar.gz SledjHamr-ce012fbbc787702bdb008c9395a80d2a08935593.tar.bz2 SledjHamr-ce012fbbc787702bdb008c9395a80d2a08935593.tar.xz |
Implement llSubStringIndex().
Diffstat (limited to '')
-rw-r--r-- | LuaSL/src/LSL.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/LuaSL/src/LSL.lua b/LuaSL/src/LSL.lua index de7f956..3ca31a8 100644 --- a/LuaSL/src/LSL.lua +++ b/LuaSL/src/LSL.lua | |||
@@ -602,7 +602,7 @@ end | |||
602 | 602 | ||
603 | 603 | ||
604 | -- LSL string functions | 604 | -- LSL string functions |
605 | function --[[string]] LSL.llGetSubString( --[[string]] text, --[[integer]] start, --[[integer]] End) | 605 | function --[[string]] LSL.llGetSubString(--[[string]] text, --[[integer]] start, --[[integer]] End) |
606 | -- Deal with the impedance mismatch. | 606 | -- Deal with the impedance mismatch. |
607 | if 0 <= start then start = start + 1 end | 607 | if 0 <= start then start = start + 1 end |
608 | if 0 <= End then End = End + 1 end | 608 | if 0 <= End then End = End + 1 end |
@@ -610,6 +610,11 @@ function --[[string]] LSL.llGetSubString( --[[string]] text, --[[integer]] start | |||
610 | return string.sub(text, start, End) | 610 | return string.sub(text, start, End) |
611 | end | 611 | end |
612 | 612 | ||
613 | function --[[integer]] LSL.llSubStringIndex(--[[string]] text, --[[string]] sub) | ||
614 | local start, End = string.find(text, sub, 1, true) | ||
615 | if nil == start then return -1 else return start - 1 end | ||
616 | end | ||
617 | |||
613 | 618 | ||
614 | -- Crements stuff. | 619 | -- Crements stuff. |
615 | 620 | ||