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.lua74
1 files changed, 72 insertions, 2 deletions
diff --git a/spec/outputs/syntax.lua b/spec/outputs/syntax.lua
index 2df3473..d975ef7 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)();
@@ -441,4 +441,74 @@ do
441 end 441 end
442 end)()) 442 end)())
443end 443end
444do
445 a = 1
446 local b = 2
447 local c = a + b
448 print(a)
449 print(b)
450 print(c)
451 f = function()
452 a = 1
453 b = 2
454 return a + b
455 end
456 a = 1
457 b = 2
458 local success, result = pcall(function()
459 return func()
460 end)
461 if success then
462 print(result)
463 end
464 local value = "foo"
465 print(value)
466 value = value .. "bar"
467 print(value)
468 do
469 if ok then
470 print("ok!")
471 end
472 return 42
473 end
474 for i = 1, 3 do
475 print(i)
476 goto _continue_0
477 ::_continue_0::
478 end
479 local n = 0
480 while n < 2 do
481 print("n=", n)
482 n = n + 1
483 end
484 local obj = { }
485 obj:set(10)
486 obj:get()
487 print("done")
488 do
489 local _with_0 = tbl
490 _with_0:push(1)
491 print("push")
492 end
493 a = 5
494 if a > 3 then
495 print("big")
496 b = a * 2
497 print(b)
498 else
499 print("small")
500 b = a
501 end
502 xpcall(function()
503 x = 1
504 y = 2
505 return print(x + y)
506 end, function(err)
507 return print("error:", err)
508 end)
509 local q = 1
510 local w = 2
511 local e = 3
512 print(q, w, e)
513end
444return nil 514return nil