aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib/LSL.lua
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/LSL.lua30
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")
465newFunc("key", "llList2Key", "list l", "integer index") 465newFunc("key", "llList2Key", "list l", "integer index")
466newFunc("list", "llList2List", "list l", "integer start", "integer End") 466newFunc("list", "llList2List", "list l", "integer start", "integer End")
467newFunc("string", "llList2String", "list l", "integer index") 467newFunc("string", "llList2String", "list l", "integer index")
468newFunc("rotation", "llList2Rotation", "list l", "integer index") 468newFunc("rotation", "llList2Rot", "list l", "integer index")
469newFunc("vector", "llList2Vector", "list l", "integer index") 469newFunc("vector", "llList2Vector", "list l", "integer index")
470newFunc("integer", "llListFindList", "list l", "list l1") 470newFunc("integer", "llListFindList", "list l", "list l1")
471newFunc("list", "llListInsertList", "list l", "list l1", "integer index") 471newFunc("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
582end 582end
@@ -586,7 +586,7 @@ function --[[integer]] LSL.llGetListLength(--[[list]] l)
586end 586end
587 587
588function --[[string]] LSL.llList2CSV(--[[list]] l) 588function --[[string]] LSL.llList2CSV(--[[list]] l)
589 return LSL.llDumpList2String(l, ",") 589 return LSL.llDumpList2String(l, ", ")
590end 590end
591 591
592function --[[float]] LSL.llList2Float(--[[list]] l,--[[integer]] index) 592function --[[float]] LSL.llList2Float(--[[list]] l,--[[integer]] index)
@@ -629,20 +629,38 @@ end
629 629
630function --[[string]] LSL.llList2String(--[[list]] l,--[[integer]] index) 630function --[[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
633end 642end
634 643
635function --[[rotation]] LSL.llList2Rotation(--[[list]] l,--[[integer]] index) 644function --[[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
640end 654end
641 655
642function --[[vector]] LSL.llList2Vector(--[[list]] l,--[[integer]] index) 656function --[[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
647end 665end
648 666