From c56683d28df52e2719cfcecb6572675ad01c288a Mon Sep 17 00:00:00 2001 From: Ibrahim Abdulhameed Date: Mon, 1 Sep 2025 12:59:35 +0100 Subject: [PATCH] feat: add examples of functions without parenthesis --- source/_posts/lua.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/source/_posts/lua.md b/source/_posts/lua.md index 139f197..1efa4ef 100644 --- a/source/_posts/lua.md +++ b/source/_posts/lua.md @@ -315,6 +315,21 @@ doAction('write', "Shirley", "Abed") --> Doing 'write' to Shirley Abed ``` +You can omit parentheses if the argument is one string or table literal + +```lua +print "Hello World" --> print("Hello World") + +dofile 'a.lua' --> dofile ('a.lua') + +print [[a multi-line --> print([[a multi-line + message]] message]]) + +f{x=10, y=20} --> f({x=10, y=20}) + +type{} --> type({}) +``` + ## Data Type APIs ### Strings