aboutsummaryrefslogtreecommitdiff
path: root/spec/outputs/syntax.lua
diff options
context:
space:
mode:
Diffstat (limited to 'spec/outputs/syntax.lua')
-rw-r--r--spec/outputs/syntax.lua94
1 files changed, 92 insertions, 2 deletions
diff --git a/spec/outputs/syntax.lua b/spec/outputs/syntax.lua
index 040a325..eb4543c 100644
--- a/spec/outputs/syntax.lua
+++ b/spec/outputs/syntax.lua
@@ -5,9 +5,9 @@ func(arg1, arg2, another, arg3)
5local we 5local we
6here, we = function() end, yeah 6here, we = function() end, yeah
7local the, different 7local the, different
8the, different = function() 8the, different = (function()
9 return approach 9 return approach
10end, yeah 10end), yeah
11dad() 11dad()
12dad(lord) 12dad(lord)
13hello(one, two)(); 13hello(one, two)();
@@ -430,4 +430,94 @@ do
430 local f2 430 local f2
431 f2 = function() end 431 f2 = function() end
432end 432end
433do
434 if res ~= "" then
435 return res
436 end
437end
438do
439 return res((function()
440 if res ~= "" then
441 end
442 end)())
443end
444do
445 x = 1
446 y = 2
447 i = i + 1
448 j = j + 1
449 if condition then
450 setup()
451 run()
452 cleanup()
453 end
454 a = 1
455 local b = 2
456 local c = a + b
457 print(a)
458 print(b)
459 print(c)
460 f = function()
461 a = 1
462 b = 2
463 return a + b
464 end
465 a = 1
466 b = 2
467 local success, result = pcall(function()
468 return func()
469 end)
470 if success then
471 print(result)
472 end
473 local value = "foo"
474 print(value)
475 value = value .. "bar"
476 print(value)
477 do
478 if ok then
479 print("ok!")
480 end
481 return 42
482 end
483 for i = 1, 3 do
484 print(i)
485 goto _continue_0
486 ::_continue_0::
487 end
488 local n = 0
489 while n < 2 do
490 print("n=", n)
491 n = n + 1
492 end
493 local obj = { }
494 obj:set(10)
495 obj:get()
496 print("done")
497 do
498 local _with_0 = tbl
499 _with_0:push(1)
500 print("push")
501 end
502 a = 5
503 if a > 3 then
504 print("big")
505 b = a * 2
506 print(b)
507 else
508 print("small")
509 b = a
510 end
511 xpcall(function()
512 x = 1
513 y = 2
514 return print(x + y)
515 end, function(err)
516 return print("error:", err)
517 end)
518end
519local q = 1
520local w = 2
521local e = 3
522print(q, w, e)
433return nil 523return nil