diff options
author | Li Jin <dragon-fly@qq.com> | 2022-04-25 13:19:26 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2022-04-25 13:19:45 +0800 |
commit | 10afeaf30bfe03774c12908235520eebf0c192ee (patch) | |
tree | ca266b04aaea63ea0710a51708d6ef806008b34e /spec/outputs/tables.lua | |
parent | 249e1de1d32dda2b60b9116c5a4e538475de0192 (diff) | |
download | yuescript-10afeaf30bfe03774c12908235520eebf0c192ee.tar.gz yuescript-10afeaf30bfe03774c12908235520eebf0c192ee.tar.bz2 yuescript-10afeaf30bfe03774c12908235520eebf0c192ee.zip |
add spread syntax support for table block. fix a gcc compiler issue. update doc.
Diffstat (limited to 'spec/outputs/tables.lua')
-rw-r--r-- | spec/outputs/tables.lua | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/spec/outputs/tables.lua b/spec/outputs/tables.lua index 165706d..1d28a43 100644 --- a/spec/outputs/tables.lua +++ b/spec/outputs/tables.lua | |||
@@ -527,4 +527,65 @@ do | |||
527 | _tab_0["else"] = false | 527 | _tab_0["else"] = false |
528 | specializedB = _tab_0 | 528 | specializedB = _tab_0 |
529 | end | 529 | end |
530 | local parts = { | ||
531 | "shoulders", | ||
532 | "knees" | ||
533 | } | ||
534 | local lyrics | ||
535 | do | ||
536 | local _tab_0 = { | ||
537 | "head" | ||
538 | } | ||
539 | local _idx_0 = 1 | ||
540 | for _key_0, _value_0 in pairs(parts) do | ||
541 | if _idx_0 == _key_0 then | ||
542 | _tab_0[#_tab_0 + 1] = _value_0 | ||
543 | _idx_0 = _idx_0 + 1 | ||
544 | else | ||
545 | _tab_0[_key_0] = _value_0 | ||
546 | end | ||
547 | end | ||
548 | _tab_0[#_tab_0 + 1] = "and" | ||
549 | _tab_0[#_tab_0 + 1] = "toes" | ||
550 | lyrics = _tab_0 | ||
551 | end | ||
552 | local tbBlock = { | ||
553 | sub = (function(...) | ||
554 | local _tab_0 = { | ||
555 | value = value | ||
556 | } | ||
557 | local _idx_0 = 1 | ||
558 | for _key_0, _value_0 in pairs(items) do | ||
559 | if _idx_0 == _key_0 then | ||
560 | _tab_0[#_tab_0 + 1] = _value_0 | ||
561 | _idx_0 = _idx_0 + 1 | ||
562 | else | ||
563 | _tab_0[_key_0] = _value_0 | ||
564 | end | ||
565 | end | ||
566 | for _index_0 = 1, select('#', ...) do | ||
567 | _tab_0[#_tab_0 + 1] = select(_index_0, ...) | ||
568 | end | ||
569 | return _tab_0 | ||
570 | end)(...) | ||
571 | } | ||
572 | func((function(...) | ||
573 | local _tab_0 = { } | ||
574 | local _idx_0 = 1 | ||
575 | for _key_0, _value_0 in pairs(items) do | ||
576 | if _idx_0 == _key_0 then | ||
577 | _tab_0[#_tab_0 + 1] = _value_0 | ||
578 | _idx_0 = _idx_0 + 1 | ||
579 | else | ||
580 | _tab_0[_key_0] = _value_0 | ||
581 | end | ||
582 | end | ||
583 | _tab_0.value = value | ||
584 | _tab_0[#_tab_0 + 1] = ... | ||
585 | _tab_0.k = v | ||
586 | for _index_0 = 1, select('#', ...) do | ||
587 | _tab_0[#_tab_0 + 1] = select(_index_0, ...) | ||
588 | end | ||
589 | return _tab_0 | ||
590 | end)(...)) | ||
530 | return nil | 591 | return nil |