diff options
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() |
