diff options
Diffstat (limited to 'spec/outputs/codes_from_doc.lua')
| -rw-r--r-- | spec/outputs/codes_from_doc.lua | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/spec/outputs/codes_from_doc.lua b/spec/outputs/codes_from_doc.lua index b7d1236..055e79b 100644 --- a/spec/outputs/codes_from_doc.lua +++ b/spec/outputs/codes_from_doc.lua | |||
| @@ -923,6 +923,36 @@ if func(1, 2, 3, "hello", "world") then | |||
| 923 | print("hello") | 923 | print("hello") |
| 924 | print("I am inside if") | 924 | print("I am inside if") |
| 925 | end | 925 | end |
| 926 | local f1 | ||
| 927 | f1 = function(_arg_0) | ||
| 928 | local a, b, c | ||
| 929 | a, b, c = _arg_0.a, _arg_0.b, _arg_0.c | ||
| 930 | return print(a, b, c) | ||
| 931 | end | ||
| 932 | f1({ | ||
| 933 | a = 1, | ||
| 934 | b = "2", | ||
| 935 | c = { } | ||
| 936 | }) | ||
| 937 | local f2 | ||
| 938 | f2 = function(_arg_0, c) | ||
| 939 | local a1, b | ||
| 940 | a1, b = _arg_0.a, _arg_0.b | ||
| 941 | if a1 == nil then | ||
| 942 | a1 = 123 | ||
| 943 | end | ||
| 944 | if b == nil then | ||
| 945 | b = 'abc' | ||
| 946 | end | ||
| 947 | if c == nil then | ||
| 948 | c = { } | ||
| 949 | end | ||
| 950 | return print(a1, b, c) | ||
| 951 | end | ||
| 952 | local arg1 = { | ||
| 953 | a = 0 | ||
| 954 | } | ||
| 955 | f2(arg1, arg2) | ||
| 926 | f(function() | 956 | f(function() |
| 927 | return print("hello") | 957 | return print("hello") |
| 928 | end) | 958 | end) |
| @@ -3332,6 +3362,66 @@ if func(1, 2, 3, "hello", "world") then | |||
| 3332 | print("hello") | 3362 | print("hello") |
| 3333 | print("I am inside if") | 3363 | print("I am inside if") |
| 3334 | end | 3364 | end |
| 3365 | local f1 | ||
| 3366 | f1 = function(_arg_0) | ||
| 3367 | local a, b, c | ||
| 3368 | a, b, c = _arg_0.a, _arg_0.b, _arg_0.c | ||
| 3369 | return print(a, b, c) | ||
| 3370 | end | ||
| 3371 | f1({ | ||
| 3372 | a = 1, | ||
| 3373 | b = "2", | ||
| 3374 | c = { } | ||
| 3375 | }) | ||
| 3376 | local f2 | ||
| 3377 | f2 = function(_arg_0, c) | ||
| 3378 | local a1, b | ||
| 3379 | a1, b = _arg_0.a, _arg_0.b | ||
| 3380 | if a1 == nil then | ||
| 3381 | a1 = 123 | ||
| 3382 | end | ||
| 3383 | if b == nil then | ||
| 3384 | b = 'abc' | ||
| 3385 | end | ||
| 3386 | if c == nil then | ||
| 3387 | c = { } | ||
| 3388 | end | ||
| 3389 | end | ||
| 3390 | print(a1, b, c) | ||
| 3391 | local arg1 = { | ||
| 3392 | a = 0 | ||
| 3393 | } | ||
| 3394 | f2(arg1, arg2) | ||
| 3395 | local findFirstEven | ||
| 3396 | findFirstEven = function(list) | ||
| 3397 | for _index_0 = 1, #list do | ||
| 3398 | local item = list[_index_0] | ||
| 3399 | if type(item) == "table" then | ||
| 3400 | for _index_1 = 1, #item do | ||
| 3401 | local sub = item[_index_1] | ||
| 3402 | if sub % 2 == 0 then | ||
| 3403 | return sub | ||
| 3404 | end | ||
| 3405 | end | ||
| 3406 | end | ||
| 3407 | end | ||
| 3408 | return nil | ||
| 3409 | end | ||
| 3410 | local findFirstEven | ||
| 3411 | findFirstEven = function(list) | ||
| 3412 | for _index_0 = 1, #list do | ||
| 3413 | local item = list[_index_0] | ||
| 3414 | if type(item) == "table" then | ||
| 3415 | for _index_1 = 1, #item do | ||
| 3416 | local sub = item[_index_1] | ||
| 3417 | if sub % 2 == 0 then | ||
| 3418 | return sub | ||
| 3419 | end | ||
| 3420 | end | ||
| 3421 | end | ||
| 3422 | end | ||
| 3423 | return nil | ||
| 3424 | end | ||
| 3335 | f(function() | 3425 | f(function() |
| 3336 | return print("hello") | 3426 | return print("hello") |
| 3337 | end) | 3427 | end) |
