diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-22 11:19:54 +0100 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-22 11:19:54 +0100 |
| commit | 19dadd080226d2e7c6dc44a53eb0ee3ee2afcbae (patch) | |
| tree | 97f0b4b584b33bc11da1edac1ab9b7eea3413888 /tests | |
| parent | 5ed59329be62c0b3a59fb47a89fd8c00a74bed5d (diff) | |
| download | crep-19dadd080226d2e7c6dc44a53eb0ee3ee2afcbae.tar.gz | |
Add Lua grammar
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test.lua | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/test.lua b/tests/test.lua new file mode 100644 index 0000000..32e18c7 --- /dev/null +++ b/tests/test.lua @@ -0,0 +1,34 @@ +-- Standard function declaration +function hello(name) + print("Hello, " .. name) +end + +-- Local function declaration +local function secret_formula(x, y) + return x * y + 42 +end + +-- Function assigned to a variable +myfunc = function(a, b) + return a - b +end + +-- Method-like function +local MyTable = {} +function MyTable:greet() + print("Greetings!") +end + +-- Nested function +function outer() + local function inner() + print("I am inside") + end + inner() +end + +hello("User") +secret_formula(1, 2) +myfunc(10, 5) +MyTable:greet() +outer() |
