Lua syntax element that I don't understand

I am using a Lua-based product, I am using their API, and there is some syntax that I don’t understand.

What is it? This is a function call for Add, and if so, what are the input parameters - there is nothing the purpose of this table is to enter a variable - no equals sign?

Is this function definition for Add - it seems strange without any implementation and indicating what is in the input tables?

Add a table containing tables? I have never seen a table created with parentheses, not braces?

serviceDefinitions.Add(
    input { name="p1", baseType="NUMBER", description="The first addend of the 
    operation" },
    input { name="p2", baseType="NUMBER", description="The second addend of the operation" },
    output { baseType="NUMBER", description="The sum of the two parameters" },
    description { "Add two numbers" }
)
+4
source share
2 answers

, , , . manual:

. f{fields} f({fields}); - . f'string' ( f"string" f[[string]]) f('string'), .. .

, :

somefunction({1,2,3,4})
somefunction{1,2,3,4}

:

print('hello!')
print 'hello!'
+6

, ( ):

serviceDefinitions.Add(
    input {
        name="p1",
        baseType="NUMBER",
        description="The first addend of the operation"
    },
    input {
        name="p2",
        baseType="NUMBER",
        description="The second addend of the operation"
    },
    output {
        baseType="NUMBER",
        description="The sum of the two parameters"
    },
    description {
        "Add two numbers"
    }
)

Add serviceDefinitions table/class/struct/object 4 . lua , input, output description .

Add.

+2

Source: https://habr.com/ru/post/1683031/


All Articles