diff options
Diffstat (limited to '')
-rw-r--r-- | lib/LSL.lua | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/lib/LSL.lua b/lib/LSL.lua index e783087..c64a3bc 100644 --- a/lib/LSL.lua +++ b/lib/LSL.lua | |||
@@ -465,7 +465,7 @@ newFunc("integer", "llList2Integer", "list l", "integer index") | |||
465 | newFunc("key", "llList2Key", "list l", "integer index") | 465 | newFunc("key", "llList2Key", "list l", "integer index") |
466 | newFunc("list", "llList2List", "list l", "integer start", "integer End") | 466 | newFunc("list", "llList2List", "list l", "integer start", "integer End") |
467 | newFunc("string", "llList2String", "list l", "integer index") | 467 | newFunc("string", "llList2String", "list l", "integer index") |
468 | newFunc("rotation", "llList2Rotation", "list l", "integer index") | 468 | newFunc("rotation", "llList2Rot", "list l", "integer index") |
469 | newFunc("vector", "llList2Vector", "list l", "integer index") | 469 | newFunc("vector", "llList2Vector", "list l", "integer index") |
470 | newFunc("integer", "llListFindList", "list l", "list l1") | 470 | newFunc("integer", "llListFindList", "list l", "list l1") |
471 | newFunc("list", "llListInsertList", "list l", "list l1", "integer index") | 471 | newFunc("list", "llListInsertList", "list l", "list l1", "integer index") |
@@ -576,7 +576,7 @@ function --[[string]] LSL.llDumpList2String(--[[list]] l, --[[string]] separator | |||
576 | local result = "" | 576 | local result = "" |
577 | for i = 1,#l do | 577 | for i = 1,#l do |
578 | if "" ~= result then result = result .. separator end | 578 | if "" ~= result then result = result .. separator end |
579 | result = result .. l[i] | 579 | result = result .. LSL.llList2String(l, i) |
580 | end | 580 | end |
581 | return result | 581 | return result |
582 | end | 582 | end |
@@ -586,7 +586,7 @@ function --[[integer]] LSL.llGetListLength(--[[list]] l) | |||
586 | end | 586 | end |
587 | 587 | ||
588 | function --[[string]] LSL.llList2CSV(--[[list]] l) | 588 | function --[[string]] LSL.llList2CSV(--[[list]] l) |
589 | return LSL.llDumpList2String(l, ",") | 589 | return LSL.llDumpList2String(l, ", ") |
590 | end | 590 | end |
591 | 591 | ||
592 | function --[[float]] LSL.llList2Float(--[[list]] l,--[[integer]] index) | 592 | function --[[float]] LSL.llList2Float(--[[list]] l,--[[integer]] index) |
@@ -629,20 +629,38 @@ end | |||
629 | 629 | ||
630 | function --[[string]] LSL.llList2String(--[[list]] l,--[[integer]] index) | 630 | function --[[string]] LSL.llList2String(--[[list]] l,--[[integer]] index) |
631 | local result = l[index+1] | 631 | local result = l[index+1] |
632 | |||
633 | if 'table' == type(result) then | ||
634 | -- Figure out if things are vectors or rotations, so we can output <> instead of []. | ||
635 | if nil == result.x then | ||
636 | result = '[' .. LSL.llDumpList2String(result, ', ') .. ']' | ||
637 | else | ||
638 | result = '<' .. LSL.llDumpList2String(result, ', ') .. '>' | ||
639 | end | ||
640 | end | ||
632 | if result then return "" .. result else return "" end | 641 | if result then return "" .. result else return "" end |
633 | end | 642 | end |
634 | 643 | ||
635 | function --[[rotation]] LSL.llList2Rotation(--[[list]] l,--[[integer]] index) | 644 | function --[[rotation]] LSL.llList2Rot(--[[list]] l,--[[integer]] index) |
636 | local result = l[index+1] | 645 | local result = l[index+1] |
637 | if nil == result then result = LSL.ZERO_ROTATION end | 646 | if nil == result then result = LSL.ZERO_ROTATION end |
638 | -- TODO - check if it's not an actual rotation, then return LSS.ZERO_ROTATION | 647 | -- Check if it's not an actual rotation, then return LSS.ZERO_ROTATION |
648 | if 'table' ~= type(result) then result = LSL.ZERO_ROTATION end | ||
649 | if nil == result.x then result = LSL.ZERO_ROTATION end | ||
650 | if nil == result.y then result = LSL.ZERO_ROTATION end | ||
651 | if nil == result.z then result = LSL.ZERO_ROTATION end | ||
652 | if nil == result.s then result = LSL.ZERO_ROTATION end | ||
639 | return result | 653 | return result |
640 | end | 654 | end |
641 | 655 | ||
642 | function --[[vector]] LSL.llList2Vector(--[[list]] l,--[[integer]] index) | 656 | function --[[vector]] LSL.llList2Vector(--[[list]] l,--[[integer]] index) |
643 | local result = l[index+1] | 657 | local result = l[index+1] |
644 | if nil == result then result = LSL.ZERO_VECTOR end | 658 | if nil == result then result = LSL.ZERO_VECTOR end |
645 | -- TODO - check if it's not an actual rotation, then return LSS.ZERO_VECTOR | 659 | -- Check if it's not an actual rotation, then return LSS.ZERO_VECTOR |
660 | if 'table' ~= type(result) then result = LSL.ZERO_VECTOR end | ||
661 | if nil == result.x then result = LSL.ZERO_VECTOR end | ||
662 | if nil == result.y then result = LSL.ZERO_VECTOR end | ||
663 | if nil == result.z then result = LSL.ZERO_VECTOR end | ||
646 | return result | 664 | return result |
647 | end | 665 | end |
648 | 666 | ||