diff options
author | David Walter Seikel | 2014-05-15 13:51:10 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-05-15 13:51:10 +1000 |
commit | eefb4ba8d166bcf54d4af5ea318d1efae769e461 (patch) | |
tree | 45c75337d1af740856f8e4f92bd3c584d3a75a1d | |
parent | Implement llParseStringKeepNulls() and llParseString2List(). (diff) | |
download | SledjHamr-eefb4ba8d166bcf54d4af5ea318d1efae769e461.zip SledjHamr-eefb4ba8d166bcf54d4af5ea318d1efae769e461.tar.gz SledjHamr-eefb4ba8d166bcf54d4af5ea318d1efae769e461.tar.bz2 SledjHamr-eefb4ba8d166bcf54d4af5ea318d1efae769e461.tar.xz |
Some more list adding and concatenation fixes.
-rw-r--r-- | lib/LSL.lua | 4 | ||||
-rw-r--r-- | src/LuaSL/LuaSL_compile.c | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/LSL.lua b/lib/LSL.lua index d61457b..ad56a37 100644 --- a/lib/LSL.lua +++ b/lib/LSL.lua | |||
@@ -984,6 +984,10 @@ function LSL.listAddList(a, b) | |||
984 | local i = 1 | 984 | local i = 1 |
985 | local result = {} | 985 | local result = {} |
986 | 986 | ||
987 | -- Deal with implicit typecasts. | ||
988 | if 'list' ~= type(a) then a = {a} end | ||
989 | if 'list' ~= type(b) then b = {b} end | ||
990 | |||
987 | for j, v in ipairs(a) do | 991 | for j, v in ipairs(a) do |
988 | i = i + 1 | 992 | i = i + 1 |
989 | table.insert(result, i, v) | 993 | table.insert(result, i, v) |
diff --git a/src/LuaSL/LuaSL_compile.c b/src/LuaSL/LuaSL_compile.c index e31e157..492f234 100644 --- a/src/LuaSL/LuaSL_compile.c +++ b/src/LuaSL/LuaSL_compile.c | |||
@@ -478,7 +478,6 @@ LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, | |||
478 | break; | 478 | break; |
479 | 479 | ||
480 | case ST_ADD : | 480 | case ST_ADD : |
481 | // TODO - This doesn't work if the right side has been cast to a list. | ||
482 | if (OT_listList == lval->basicType) | 481 | if (OT_listList == lval->basicType) |
483 | { | 482 | { |
484 | lval->basicType = OT_list; | 483 | lval->basicType = OT_list; |
@@ -492,7 +491,13 @@ LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, | |||
492 | break; | 491 | break; |
493 | 492 | ||
494 | case ST_CONCATENATION : | 493 | case ST_CONCATENATION : |
495 | if ((OT_list == lType) && (OT_list != rType)) | 494 | // TODO - This doesn't work if the right side has been cast to a list. |
495 | if (OT_listList == lval->basicType) | ||
496 | { | ||
497 | lval->basicType = OT_list; | ||
498 | lval->toKen = tokens[LSL_LIST_ADD_LIST - lowestToken]; | ||
499 | } | ||
500 | else if ((OT_list == lType) && (OT_list != rType)) | ||
496 | { | 501 | { |
497 | lval->basicType = OT_list; | 502 | lval->basicType = OT_list; |
498 | lval->toKen = tokens[LSL_LIST_CONCAT - lowestToken]; | 503 | lval->toKen = tokens[LSL_LIST_CONCAT - lowestToken]; |